openwebrtc-ios-sdk icon indicating copy to clipboard operation
openwebrtc-ios-sdk copied to clipboard

Best approach to setup one-way video without local sources

Open zombieobject opened this issue 10 years ago • 8 comments

My objective only receive remote sources in a native iOS application.

It appears that I must use the following in order to start receiving video.

- (void)startGetCaptureSourcesForAudio:(BOOL)audio video:(BOOL)video;

Even overriding this implementation to send a media type of OWR_MEDIA_TYPE_UNKOWN and commenting out the subsequent g_assert in got_local_sources() fails to move forward with receiving video. At this point, I gather I'm going down the wrong path.

What's my best approach to stripping this down to one remote source?

Cheers ~

zombieobject avatar Apr 02 '15 21:04 zombieobject

Actually, I missed a step after commenting out the g_assert in got_local_sources for OpenWebRTCNativeHandler and that does move me onward to receiving the remote source video. It still feels like I'm heading down the wrong path by calling this.

Suggestions, pointers welcome. :D

zombieobject avatar Apr 02 '15 21:04 zombieobject

I think I've found the right direction. I added a startSession method that achieves my goal. I'll paste here to confirm I'm not doing something too crazy. :D

- (void)startSesssion
{

    transport_agent = owr_transport_agent_new(FALSE);

    for (NSDictionary *server in staticSelf.helperServers) {
        owr_transport_agent_add_helper_server(transport_agent,
                                              (OwrHelperServerType)[server[@"type"] intValue],
                                              [server[@"address"] UTF8String],
                                              [server[@"port"] intValue],
                                              [server[@"username"] UTF8String],
                                              [server[@"password"] UTF8String]);
    }

    // Handle cached remote candidates.
    @synchronized (staticSelf.remoteCandidatesCache) {
        [staticSelf.remoteCandidatesCache enumerateObjectsUsingBlock:^(NSDictionary *candidate, NSUInteger idx, BOOL *stop) {
            [staticSelf handleRemoteCandidateReceived:candidate];
        }];
        [staticSelf.remoteCandidatesCache removeAllObjects];
    }
}

Cheers ~

zombieobject avatar Apr 02 '15 22:04 zombieobject

If I'm heading down the right path, I'll clean it up by updating - (void)startGetCaptureSourcesForAudio:(BOOL)audio video:(BOOL)video; to use OWR_MEDIA_TYPE_UNKOWN in the case of a double NO and subsequently update static void got_local_sources(GList *sources) to be aware of this type and submit a pull request.

The method signature of - (void)startGetCaptureSourcesForAudio:(BOOL)audio video:(BOOL)video; could be changed to be more of a generic selector as well.

Potentially: -(void)startSessionForAudio:(BOOL)audio video:(BOOL)video; thus removing the "capture" language.

zombieobject avatar Apr 03 '15 00:04 zombieobject

@zombieobject I think that is a good suggestion. Please submit a PR when ready, thanks!

stefanalund avatar Apr 04 '15 08:04 stefanalund

How's it going?

stefanalund avatar Apr 20 '15 04:04 stefanalund

I only changed that what you mentioned in your first comment. (change to startGetCaptureSourcesForAudio and remove the g_assert) and that seems to function. I do receive a remote video without sending something myself.

So i wonder: What was the missed step?

I see that you added the startSession as an alternative to got_local_sources but then without handling the sources. Wouldn't it be easier to just add a check for sources in the got_local_sources?

evermeer avatar May 05 '15 08:05 evermeer

Hi. I need in one-way video (only recieve). I have the last version of OpenWebRTC-SDK. So I use this method in case: [nativeHandler startGetCaptureSourcesForAudio:NO video:NO];

In my log only: GLib-CRITICAL *: g_main_context_push_thread_default: assertion 'acquired_context' failed GLib-CRITICAL *: g_main_context_pop_thread_default: assertion 'stack != NULL' failed

After [nativeHandler initiateCall] in log only:

can_send_offer

Nothing more. nativeHandler doesn't generating offer. Nothing happen. I tested it in NativeDemo app (with http://demo.openwebrtc.io:38080/ pair). In my application the same problem.

P.S. if I initiate call from site or other devise with [nativeHandler startGetCaptureSourcesForAudio:NO video:YES]; everything working good. I have one-way video streaming on my first devise

byhkalo avatar Aug 26 '15 13:08 byhkalo

Perhaps some modifications are going to be needed to allow for the receive only case. The iOS SDK is not as developed and flexible as the Android SDK. Hopefully it can be synchronised.

superdump avatar Aug 31 '15 07:08 superdump