static void link_session_and_fetch_conf(Nemesi_DemuxerStreamData * ndsd, Nemesi_SessionType stype, rtp_session * sess, rtp_buff * buff, unsigned int * fps) { rtp_ssrc *ssrc = NULL; rtp_frame * fr = &ndsd->first_pkt[stype]; rtp_buff trash_buff; int must_prefetch = ((fps != NULL) || (buff != NULL)) ? 1 : 0; ndsd->session[stype] = sess; ssrc = wait_for_packets(ndsd, stype); if ( ((ssrc) && (must_prefetch)) ) { if (buff == NULL) buff = &trash_buff; rtp_fill_buffer(ssrc, fr, buff); //Prefetch the first packet /* Packet prefecthing must be done anyway or we won't be able to get the metadata, but fps calculation happens only if the user didn't specify the FPS */ if ( ((!force_fps) && (fps != NULL)) ) { while ( *fps <= 0 ) { //Wait more pkts to calculate FPS and try again sched_yield(); *fps = rtp_get_fps(ssrc); } } } }
static void link_session_and_fetch_conf(Nemesi_DemuxerStreamData * ndsd, Nemesi_SessionType stype, rtp_session * sess, rtp_buff * buff, unsigned int * fps) { extern float force_fps; rtp_ssrc *ssrc; rtsp_ctrl * ctl = ndsd->rtsp; rtp_frame * fr = &ndsd->first_pkt[stype]; rtp_buff trash_buff; ndsd->session[stype] = sess; if (buff == NULL) buff = &trash_buff; if ( (buff != NULL) || (fps != NULL) ) { rtp_fill_buffers(rtsp_get_rtp_th(ctl)); for (ssrc = rtp_active_ssrc_queue(rtsp_get_rtp_queue(ctl)); ssrc; ssrc = rtp_next_active_ssrc(ssrc)) { if (ssrc->rtp_sess == sess) { rtp_fill_buffer(ssrc, fr, buff); break; } } if ( (force_fps == 0.0) && (fps != NULL) ) { rtp_fill_buffers(rtsp_get_rtp_th(ctl)); *fps = rtp_get_fps(ssrc); } } }