Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error closing and re-opening local stream several times #247

Closed
logidelic opened this issue Jan 10, 2017 · 13 comments
Closed

Error closing and re-opening local stream several times #247

logidelic opened this issue Jan 10, 2017 · 13 comments

Comments

@logidelic
Copy link

logidelic commented Jan 10, 2017

I've experienced a total failure of iosrtc (or libwebrtc) when I get and free the local stream a few times on iOS 10.2. (I thought that this issue was specific to iOS 10.2, but I can no longer be certain.)

Below is an isolated, self-contained repro (you can't run it directly on that server because it's not HTTPS; you'll have to save the HTML). I was able to repro this issue 100% by killing and restarting the app and following the steps below. However, after rebooting my device, the issue does not reproduce as easily. I am attempting to isolate further.

http://ecobyte.com/tmp/DEBUG_WEBRTC.html

To repro:

  • After the cordova plugins are loaded, click the "Begin tests" button. You will see that the video from the front camera displays.
  • The stream will be freed and restarted repeatedly.
  • After a number of times the video frame will be black. (It was always broken by the 5th attempt for me before rebooting; now it takes many restarts)
  • It will never work again. iosrtc is broken at this point until the application is killed and restarted.

Let me know if you would like more info.

@ghost
Copy link

ghost commented Jan 11, 2017

Im having a similar issue in iOS 10.2 , when I lock the device it losses the websocket connection. It was working perfectly on iOS 9.3.

@saghul
Copy link
Collaborator

saghul commented Jan 11, 2017

Im having a similar issue in iOS 10.2 , when I lock the device it losses the websocket connection. It was working perfectly on iOS 9.3.

How is that related to this plugin?

@logidelic
Copy link
Author

logidelic commented Jan 11, 2017

After rebooting the device, I'm not longer able to repro the issue so easily. There is some problem here (I was able to see it on two different devices), but I need to isolate further since a reboot somehow fixes it temporarily.

I will edit my original issue and post more when I've isolated further.

@logidelic logidelic changed the title Error reconnecting on iOS 10.2 Error closing and re-opening local stream several times Jan 11, 2017
@mruffa
Copy link

mruffa commented Jan 11, 2017

In my project, I started to get the same problems as @logidelic mentioned.

Logs, when everything is OK.

2017-01-11 16:32:22.995273 [1479:542944] iosrtcPlugin#MediaStreamTrack_stop()
2017-01-11 16:32:23.000748 [1479:545743] PluginMediaStreamTrack#stop() [kind:video, id:1709C50C-65AB-4CE0-B4A0-79649482B726]
2017-01-11 16:32:23.001081 [1479:545743] PluginMediaStreamTrack#stop() | stop() not implemented (see: #140
2017-01-11 16:32:23.002623 [1479:543037] PluginMediaStreamTrack | state changed [kind:video, id:1709C50C-65AB-4CE0-B4A0-79649482B726, state:live, enabled:false]
2017-01-11 16:32:23.592521 [1479:542944] iosrtcPlugin#MediaStreamRenderer_close()
2017-01-11 16:32:23.592756 [1479:542944] PluginMediaStreamRenderer#close()
2017-01-11 16:32:23.592872 [1479:542944] PluginMediaStreamRenderer#reset()
2017-01-11 16:32:23.593561 [1479:542944] PluginMediaStreamRenderer#deinit()
2017-01-11 16:32:23.994704 [1479:542944] iosrtcPlugin#getUserMedia()
2017-01-11 16:32:23.994909 [1479:542944] PluginGetUserMedia#call()
2017-01-11 16:32:23.995146 [1479:542944] PluginGetUserMedia#call() | video authorization: authorized
2017-01-11 16:32:23.996085 [1479:542944] PluginGetUserMedia#call() | video requested (device not specified)
2017-01-11 16:32:23.996529 [1479:542944] PluginGetUserMedia#call() | chosen video device: <AVCaptureFigVideoDevice: 0x109d779e0 [Front Camera][com.apple.avfoundation.avcapturedevice.built-in_video:1]>
2017-01-11 16:32:24.188803 [1479:542944] PluginMediaStream#init()
2017-01-11 16:32:24.189015 [1479:542944] PluginMediaStreamTrack#init()
2017-01-11 16:32:24.190076 [1479:542944] PluginMediaStreamTrack#run() [kind:video, id:2396AA9E-3F74-4A66-AE56-E5F56C516030]
2017-01-11 16:32:24.190245 [1479:542944] PluginMediaStream#run()
2017-01-11 16:32:24.190771 [1479:542944] THREAD WARNING: ['iosrtcPlugin'] took '196.109863' ms. Plugin should use a background thread.
2017-01-11 16:32:24.207633 [1479:542944] iosrtcPlugin#MediaStreamTrack_setListener()
2017-01-11 16:32:24.207857 [1479:542944] iosrtcPlugin#MediaStream_setListener()
2017-01-11 16:32:24.207989 [1479:543120] PluginMediaStreamTrack#setListener() [kind:video, id:2396AA9E-3F74-4A66-AE56-E5F56C516030]
2017-01-11 16:32:24.208005 [1479:542944] got local media
2017-01-11 16:32:24.208095 [1479:543120] PluginMediaStream#setListener()
2017-01-11 16:32:24.226483 [1479:542944] iosrtcPlugin#new_MediaStreamRenderer()
2017-01-11 16:32:24.226592 [1479:542944] PluginMediaStreamRenderer#init()
2017-01-11 16:32:24.234934 [1479:542944] PluginMediaStreamRenderer#run()
2017-01-11 16:32:24.235200 [1479:542944] iosrtcPlugin#MediaStreamRenderer_refresh()
2017-01-11 16:32:24.235588 [1479:542944] PluginMediaStreamRenderer#refresh() [elementLeft:10.0, elementTop:10.0, elementWidth:400.0, elementHeight:400.0, videoViewWidth:400.0, videoViewHeight:400.0, visible:true, opacity:1.0, zIndex:0.0, mirrored:false, clip:true, borderRadius:0.0]
2017-01-11 16:32:24.235798 [1479:542944] iosrtcPlugin#MediaStreamRenderer_render()
2017-01-11 16:32:24.235865 [1479:542944] PluginMediaStreamRenderer#render()
2017-01-11 16:32:24.934949 [1479:542944] PluginMediaStreamRenderer | video size changed [width:480.0, height:640.0]
2017-01-11 16:32:24.940421 [1479:542944] iosrtcPlugin#MediaStreamRenderer_refresh()
2017-01-11 16:32:24.941344 [1479:542944] PluginMediaStreamRenderer#refresh() [elementLeft:10.0, elementTop:10.0, elementWidth:400.0, elementHeight:400.0, videoViewWidth:300.0, videoViewHeight:400.0, visible:true, opacity:1.0, zIndex:0.0, mirrored:false, clip:true, borderRadius:0.0]

When preview fails, I can't see last these logs.

2017-01-11 16:32:24.940421 [1479:542944] iosrtcPlugin#MediaStreamRenderer_refresh()
2017-01-11 16:32:24.941344 [1479:542944] PluginMediaStreamRenderer#refresh() [elementLeft:10.0, elementTop:10.0, elementWidth:400.0, elementHeight:400.0, videoViewWidth:300.0, videoViewHeight:400.0, visible:true, opacity:1.0, zIndex:0.0, mirrored:false, clip:true, borderRadius:0.0]

Any ideas? :)

@logidelic
Copy link
Author

I've now updated the DEBUG_WEBRTC.html test case so that you only need to tap the button once: The video will then stop and restart automatically.

Before rebooting my device, it would fail after 5 stream restarts. Now it takes many (perhaps ~50) before the issue repros.

@saghul
Copy link
Collaborator

saghul commented Jan 11, 2017

Thanks for the report! We'll have a look at it, but it may take a bit of time.

@HugoHeneault
Copy link

HugoHeneault commented Feb 27, 2018

Hi @logidelic and @mruffa

Did you manage to get it fixed? I am reproducing this issue on 3rd try every time.
I'm looking through the logs but everything seems to be fine :(

@saghul Any ideas/updates here?

@HugoHeneault
Copy link

My issue isn't with video, only audio. But I assume it's the same kind of issue.

@ghost
Copy link

ghost commented Feb 27, 2018

@HugoHeneault , what is your issue ? Youre in a call and if you lock ios device you loose connection ?

@HugoHeneault
Copy link

@NickMendes So I start and stop a first call. It works.
Then I start another, it's still working.
Then I start a 3rd one, and then, I have no sound even if everything seems to be fine (I have no errors, go the IceCandidates and descriptions and streams...)

@logidelic
Copy link
Author

@HugoHeneault unfortunately I've moved on from that project quite a while ago. I never got it to work 100% reliably, but perhaps things are better now.

@HugoHeneault
Copy link

@logidelic Thank you for your fast reply. I'll try to find a solution and come back here for anyone having the same issue if I find something...

Right now I'm trying this fork that might fixe some issues with streams not stopping: https://github.com/mark-veenstra/cordova-plugin-iosrtc

Related: #140

@hthetiot
Copy link
Contributor

hthetiot commented Oct 6, 2019

Fixed by 0545c18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants