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

The views are freezing then arise some error #5

Open
kos9kus opened this issue Jul 30, 2015 · 12 comments
Open

The views are freezing then arise some error #5

kos9kus opened this issue Jul 30, 2015 · 12 comments

Comments

@kos9kus
Copy link

kos9kus commented Jul 30, 2015

Arising some error,
onVideoError: NSConcreteNotification 0x16fc1a50 {name = AVCaptureSessionRuntimeErrorNotification; object = <AVCaptureSession: 0x180a35a0 [AVCaptureSessionPresetInputPriority]>
<AVCaptureDeviceInput: 0x16dd1ba0 [Front Camera]> -> <AVCaptureVideoDataOutput: 0x180d8a30>; userInfo = {
AVCaptureSessionErrorKey = "Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x16fb5230 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x16d0ae60 "The operation couldn\U2019t be completed. (OSStatus error -12780.)", NSLocalizedFailureReason=An unknown error occurred (-12780)}";
}}
Than: WARNING: Renegotiation needed but unimplemented.

Than the App is freezing
What should I do if delegate calls a peerConnectionOnRenegotiationNeeded method?
I disabled an execution of device rotation.
Any ideas ?
Thanks!

@kos9kus kos9kus changed the title The views are freezing the arise some error The views are freezing then arise some error Jul 30, 2015
@coolwr
Copy link
Contributor

coolwr commented Jul 30, 2015

What device model and iOS version are you using? Does this error occur
every time? In what situation do you get the error? Can you list the steps?
What AppRTC Server are you connecting to and is the remote device a web
browser or another iOS device?

--kelly

On Thu, Jul 30, 2015 at 6:46 AM, Kos notifications@github.com wrote:

Arising some error,
onVideoError: NSConcreteNotification 0x16fc1a50 {name =
AVCaptureSessionRuntimeErrorNotification; object =
-> ; userInfo = {
AVCaptureSessionErrorKey = "Error Domain=AVFoundationErrorDomain
Code=-11800 "The operation could not be completed" UserInfo=0x16fb5230
{NSLocalizedDescription=The operation could not be completed,
NSUnderlyingError=0x16d0ae60 "The operation couldn\U2019t be completed.
(OSStatus error -12780.)", NSLocalizedFailureReason=An unknown error
occurred (-12780)}";
}}
Than: WARNING: Renegotiation needed but unimplemented.

Than the App freezing
What should I do if delegate calls a peerConnectionOnRenegotiationNeeded
method?
I disabled an execution of device rotation.
Any ideas ?
Thanks!


Reply to this email directly or view it on GitHub
#5.

@kos9kus
Copy link
Author

kos9kus commented Jul 30, 2015

So, I have a iPhone5, ios 8.4
Steps: I set connection up, similar to example, then a connection is established, everything's fine, video and audio exchanging is running, then rotate the device at 180grad ( tentatively ) then local video view is freezing and in this moment the error arises. The freezing is going until I rotate the device again by the same manner and the freezing is gone, a behavior of running is very weird, following log:
onVideoError: NSConcreteNotification 0x16fc1a50 {name = AVCaptureSessionRuntimeErrorNotification; object = <AVCaptureSession: 0x180a35a0 [AVCaptureSessionPresetInputPriority]>
<AVCaptureDeviceInput: 0x16dd1ba0 [Front Camera]> -> <AVCaptureVideoDataOutput: 0x180d8a30>; userInfo = {
AVCaptureSessionErrorKey = "Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x16fb5230 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x16d0ae60 "The operation couldn\U2019t be completed. (OSStatus error -12780.)", NSLocalizedFailureReason=An unknown error occurred (-12780)}";
}}
WARNING: Renegotiation needed but unimplemented.
WARNING: Renegotiation needed but unimplemented.
Exchange happens between browser and device.
I use default google stun servers.
I think, a server side is not guilty, it depends on some video capture system. Presumably, the webrtc lib consists of a lot of wrappers of native classes ( ObjC ) and probably inside of some class call a rotation method of device.
What should i do when delegate call a peerConnectionOnRenegotiationNeeded method?
What are cases a Renegotiation occurs ??
Because the "onVideoError" error occurs in the same time with the Renegotiation WARNING.
My take on it, this 2 events are connected with each other.
Thanks

@coolwr
Copy link
Contributor

coolwr commented Jul 31, 2015

Yes, rotation seems to cause a problem and lead to crashing. What needs to
happen is before rotation the app will need to destroy the views and
recreate them after rotation in the correct orientation.

On Thu, Jul 30, 2015 at 7:59 AM, Kos notifications@github.com wrote:

So, I have a iPhone5, ios 8.4
Steps: I set connection up, similar to example, then a connection is
established, everything's fine, View and audio exchanging is running, then
rotate the device at 180grad ( tentatively ) then local video view is
freezing and in this moment the error arises. The freezing is going until I
rotate the device again by the same manner and the freezing is gone, a
behavior of running is very weird, following log:
onVideoError: NSConcreteNotification 0x16fc1a50 {name =
AVCaptureSessionRuntimeErrorNotification; object =
-> ; userInfo = {
AVCaptureSessionErrorKey = "Error Domain=AVFoundationErrorDomain
Code=-11800 "The operation could not be completed" UserInfo=0x16fb5230
{NSLocalizedDescription=The operation could not be completed,
NSUnderlyingError=0x16d0ae60 "The operation couldn\U2019t be completed.
(OSStatus error -12780.)", NSLocalizedFailureReason=An unknown error
occurred (-12780)}";
}}
WARNING: Renegotiation needed but unimplemented.
WARNING: Renegotiation needed but unimplemented.
Exchange happens between browser and device.
I use default google stun servers.
I think, a server side is not guilty, it depends on some video capture
system. Presumably, the webrtc lib consists of a lot of wrappers of native
classes ( ObjC ) and probably inside of some class call a rotation method
of device.
What should i do when delegate call a peerConnectionOnRenegotiationNeeded
method?
What are cases a Renegotiation occurs ??
Because the "onVideoError" error occurs in the same time with the
Renegotiation WARNING.
My take on it, this 2 events are connected with each other.
Thanks


Reply to this email directly or view it on GitHub
#5 (comment).

@kos9kus
Copy link
Author

kos9kus commented Jul 31, 2015

Must I do it within peerConnectionOnRenegotiationNeeded method?

@coolwr
Copy link
Contributor

coolwr commented Jul 31, 2015

Last time i looked into the issue it was related to
ARTCVideoChatViewController's videoView:didChangeVideoSize: method that is
called when orientation change. Looks like changing the frame size for
the RTCEAGLVideoView for the local and remote views is what leads to the
error.

-k

On Fri, Jul 31, 2015 at 10:50 AM, Kos notifications@github.com wrote:

Must I do it within peerConnectionOnRenegotiationNeeded method?


Reply to this email directly or view it on GitHub
#5 (comment).

@kos9kus
Copy link
Author

kos9kus commented Aug 6, 2015

Hello,
Look, Presumably I found a point that causes an issue.
Acoording to ticket: https://code.google.com/p/webrtc/issues/detail?id=3162&can=1&q=onVideoError&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20Area%20Status%20Owner%20Summary
There are discussing about stop video session on a background thread, so it's fine, a following code of ARDAppClient:

- (void)orientationChanged:(NSNotification *)notification {
    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    if (UIDeviceOrientationIsLandscape(orientation) || UIDeviceOrientationIsPortrait(orientation)) {
        //Remove current video track
        RTCMediaStream *localStream = _peerConnection.localStreams[0];
        [localStream removeVideoTrack:localStream.videoTracks[0]];

        RTCVideoTrack *localVideoTrack = [self createLocalVideoTrack];
        if (localVideoTrack) {
            [localStream addVideoTrack:localVideoTrack];
            [_delegate appClient:self didReceiveLocalVideoTrack:localVideoTrack];
        }
        [_peerConnection removeStream:localStream];
        [_peerConnection addStream:localStream];
    }
}

A [localStream removeVideoTrack:localStream.videoTracks[0]] and RTCVideoTrack *localVideoTrack = [self createLocalVideoTrack] are called from different threads and probably the system tries to call removeVideoTrack and createLocalVideoTrack simultaneously. I made a test, I inserted a pause (sth like sleep() ) between removeVideoTrack and createLocalVideoTrack, for convincing that a removeVideoTrack was executed and createLocalVideoTrack will be executed after, the problem is gone.
Look at my stack while my test was running:
screen shot 2015-08-06 at 16 48 51

The didChangeVideoSizes is selector that handles an error onVideoError ( when I talked about in the beginning).
What do you think about it? Would you agree that handling of two methods of video Capture is not good simultaneously?

@coolwr
Copy link
Contributor

coolwr commented Aug 6, 2015

Thats great to hear you solved the problem! Do you want to issue a pull
request and I can merge it into the code repository?

thanks!

On Thu, Aug 6, 2015 at 7:18 AM, Kos notifications@github.com wrote:

Hello,
Look, Presumably I found a point that causes a issue.
Acoording to ticket:
https://code.google.com/p/webrtc/issues/detail?id=3162&can=1&q=onVideoError&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20Area%20Status%20Owner%20Summary
There are discussing about stop video session on a background thread, so
it's fine, next a following code of ARDAppClient:

  • (void)orientationChanged:(NSNotification *)notification {
    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    if (UIDeviceOrientationIsLandscape(orientation) || UIDeviceOrientationIsPortrait(orientation)) {
    //Remove current video track
    RTCMediaStream *localStream = _peerConnection.localStreams[0];
    [localStream removeVideoTrack:localStream.videoTracks[0]];

    RTCVideoTrack *localVideoTrack = [self createLocalVideoTrack];
    if (localVideoTrack) {
        [localStream addVideoTrack:localVideoTrack];
        [_delegate appClient:self didReceiveLocalVideoTrack:localVideoTrack];
    }
    [_peerConnection removeStream:localStream];
    [_peerConnection addStream:localStream];
    

    }
    }

A [localStream removeVideoTrack:localStream.videoTracks[0]] and
RTCVideoTrack *localVideoTrack = [self createLocalVideoTrack] are called
from different threads and probably the system tries to call
removeVideoTrack and createLocalVideoTrack simultaneously. I made a test, I
inserted a pause (sth like sleep() ) between removeVideoTrack and
createLocalVideoTrack, for convincing that a removeVideoTrack was executed
and createLocalVideoTrack will be executed after, the problem is gone.
Look at my stack while my test was running:
[image: screen shot 2015-08-06 at 16 48 51]
https://cloud.githubusercontent.com/assets/7373566/9113418/27ef23f4-3c5d-11e5-81f8-f5f57d73a7ea.png

The didChangeVideoSizes is selector that handles an error onVideoError (
when I talked about in the beginning).
What do you think about it? Would you agree that handling of two methods
of video Capture is not good simultaneously?


Reply to this email directly or view it on GitHub
#5 (comment).

@SoapyCro
Copy link

Hi, I'm having the exact problem. For me, this error is occurring only when I add mandatoryConstraints for maxWidth and maxHeight. Without them, everything seems fine. By trial and error method I managed to find out that inserting 0.4 seconds pause anywhere between [localStream removeVideoTrack:localStream.videoTracks[0]]; and [_delegate appClient:self didReceiveLocalVideoTrack:localVideoTrack]; fixes the problem. Anything below 0.4 seconds doesn't work for me. Since pausing for 0.4 seconds is creating a delay I was wondering if there is a more elegant solution for this problem?

Thanks!

@kos9kus
Copy link
Author

kos9kus commented Aug 24, 2015

Guys look at my pull request. There are improvements regarding the issue

@SoapyCro
Copy link

Yep, works like a charm now. Thanks!
One more thing, when I used the default way to detect orientation changes using UIDeviceOrientation, it would register FaceUp and FaceDown orientation change and cause local view to be reloaded unnecessarily so I switched to UIInterfaceOrientation and that seems to work better for me.

@kadamska
Copy link

kadamska commented Jun 2, 2016

I'm using @kos9kus 's fix, and generally it works - rotates fine, with one exception - front camera, when orientation is set to 4 (UIDeviceOrientationLandscapeRight). Then I just get a black screen. Any ideas?

@Morris-Lin0408
Copy link

Morris-Lin0408 commented Aug 30, 2016

Hello guys! I Maybe fix it. This is my solution :

In ARDAppClient class

  • (void)orientationChanged:(NSNotification )notification
    {
    /

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    if (UIDeviceOrientationIsLandscape(orientation) || UIDeviceOrientationIsPortrait(orientation))
    {
    //Remove current video track
    RTCMediaStream *localStream = _peerConnection.localStreams[0];
    RTCVideoTrack *localVideoTrack = localStream.videoTracks[0];
    [localStream removeVideoTrack:localVideoTrack];

    //RTCVideoTrack *localVideoTrack = [self createLocalVideoTrack];
    if (localVideoTrack)
    {
        [localStream addVideoTrack:localVideoTrack];
        [_delegate appClient:self didReceiveLocalVideoTrack:localVideoTrack];
    }
    [_peerConnection removeStream:localStream];
    [_peerConnection addStream:localStream];
    

    }
    */
    }
    Do nothing in it

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

No branches or pull requests

5 participants