linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] oRTP using for dynamic sessions pool


From: Oleksii Vynogradov
Subject: [Linphone-developers] oRTP using for dynamic sessions pool
Date: Fri, 22 Feb 2013 17:15:30 +0200

Hi
i try to using oRTP, and i have dynamic adding sessions to play same file at runtime.
For that, i'm using that code:
        while (1) {
            while( ((i=(int)fread(buffer,1,packet_size,infile))>0))
            {
                NSMutableArray *currentRtpSessionsPCMU = nil;
                @synchronized (self.rtpSessionsPCMU) {
                    currentRtpSessionsPCMU = self.rtpSessionsPCMU;
                }
                if (currentRtpSessionsPCMU.count > 0) {
                    [currentRtpSessionsPCMU enumerateObjectsUsingBlock:^(NSDictionary *rtpSession, NSUInteger idx, BOOL *stop) {
                        NSNumber *rtpSessionIndex = [rtpSession valueForKey:@"rtpSessionIndex"];
                        session_set_set(set,sessions[rtpSessionIndex.intValue]);
                    }];
                    /* and then suspend the process by selecting() */
                    session_set_select(NULL,set,NULL);
                    [currentRtpSessionsPCMU enumerateObjectsUsingBlock:^(NSDictionary *rtpSession, NSUInteger idx, BOOL *stop) {
                        NSNumber *rtpSessionIndex = [rtpSession valueForKey:@"rtpSessionIndex"];
                        if (session_set_is_set(set,sessions[rtpSessionIndex.intValue])){
                            rtp_session_send_with_ts(sessions[rtpSessionIndex.intValue],buffer,i,user_ts);
                            //ortp_message("packet sended !");
                        }
                    }];
                }
                user_ts+=ts_inc;
            }
            fclose(infile);
            //NSLog(@"close file RTP_RING_PCMU");
            sleep(1);
            infile=fopen([finalPath UTF8String],"rb");
        }
everything working fine until i adding new session. in rtpSessionsPCMU array
second receiver don't receive nothing
i was try to close file and open again, but second receiver receive only small part of record and than don't hear nothing.
if i try to set 0 user_ts and clear buffer after close and open file, it second receiver don't receive nothing.

can you suggest peace of code to add dynamically new sessions and play same file to there? In mrtpsend all sessions created from start, in my case sessions will added and closed 
while file it going to play.
Tnx,
------ 
Oleksii Vynogradov 







reply via email to

[Prev in Thread] Current Thread [Next in Thread]