Esempio n. 1
0
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);
        }
    }
}
Esempio n. 2
0
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);
            }
        }
    }
}
Esempio n. 3
0
static int get_data_for_session(Nemesi_DemuxerStreamData * ndsd,
                                Nemesi_SessionType stype, rtp_frame * fr)
{
    rtsp_ctrl * ctl = ndsd->rtsp;
    rtp_ssrc *ssrc = NULL;

    for (ssrc = rtp_active_ssrc_queue(rtsp_get_rtp_queue(ctl));
         ssrc;
         ssrc = rtp_next_active_ssrc(ssrc)) {
        if (ssrc->rtp_sess == ndsd->session[stype]) {
            if (ndsd->first_pkt[stype].len != 0) {
                fr->data = ndsd->first_pkt[stype].data;
                fr->time_sec = ndsd->first_pkt[stype].time_sec;
                fr->len = ndsd->first_pkt[stype].len;
                ndsd->first_pkt[stype].len = 0;
                return RTP_FILL_OK;
            } else {
                rtp_buff buff;
                return rtp_fill_buffer(ssrc, fr, &buff);
            }
        }
    }

    return RTP_SSRC_NOTVALID;
}
Esempio n. 4
0
static int get_data_for_session(Nemesi_DemuxerStreamData * ndsd,
                                Nemesi_SessionType stype, rtp_ssrc * ssrc,
                                rtp_frame * fr)
{
    if (ndsd->first_pkt[stype].len != 0) {
        fr->data = ndsd->first_pkt[stype].data;
        fr->time_sec = ndsd->first_pkt[stype].time_sec;
        fr->len = ndsd->first_pkt[stype].len;
        ndsd->first_pkt[stype].len = 0;
        return RTP_FILL_OK;
    } else {
        rtp_buff buff;
        return rtp_fill_buffer(ssrc, fr, &buff);
    }
}