cordova-plugin-iosrtc: canvas drawImage(videoElem...) cause memory leak via RequestFrameAnimation

Please read first!

Please use Public Google Group (mailing list) for general technical discussions and questions.

  • I have used Google with the error message or bug in association with the library and Cordova words to make sure the issue I’m reporting is only related to iOSRTC.
  • I have provided steps to reproduce (e.g. sample code or updated extra/renderer-and-libwebrtc-tests.js file).
  • I have provided third party library name and version, ios, Xcode and plugin version and adapter.js version if used.

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.

Versions affected

  • Cordova version (e.g 7.1.0): N/A
  • Cordova iOS version (e.g 5.1.0): N/A
  • Plugin version (e.g 6.0.12): Any
  • iOS version (e.g 10.2): Any
  • Xcode version (e.g 11.1 - 11A1027): Any
  • WebRTC-adapter version (e.g. 7.4.0): Any
  • WebRTC Framework version (e.g. JSSip 3.1.2): Any

Description

It appears that the plugin doesn’t emit the necessary data for canvas drawImage(videoElem…) to function (capture the current frame basically) this prevents libraries like https://github.com/zxing-js from working.

Steps to reproduce

canvas: CanvasRenderingContext2D; videoElem: HTMLVideoElement;

canvas.drawImage(videoElem, 0, 0); // Doesn’t error but data isn’t valid

Expected results

The frame should be copied over

Actual results

Nothing is copied over

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 32 (23 by maintainers)

Most upvoted comments

My sample test project is at https://github.com/fimdomeio/iosrtc-example

And the leak: Captura de ecrã 2020-11-16, às 10 53 05

We got to the point where we realised that the memory leak disapears if in src/PluginMediaStreamRenderer.swift on the save function https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/b01a23ce1eaf3d317f161f811b3d4d206d3071c3/src/PluginMediaStreamRenderer.swift#L250 we return "0"

We suspect the leak might be happening when the string is copied from swift to javascript https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/66acf1abde34c6a16d3afd7f2a62212f28b1ecc0/src/iosrtcPlugin.swift#L972

Are you able to reproduce the memory leak or need more detailed info?

@hthetiot On it. Just stuck on xcode update and a not so fast internet connection. will give feedback ASAP.