Changeset 6a604066e435c727e04726050e2e76c0eebb1797

Show
Ignore:
Timestamp:
09/17/07 19:55:50 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1190051750 +0000
git-parent:

[ed8d5bcb8798ed7257c9b8d8f3f1cf8e5c49db09]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1190051750 +0000
Message:

Attempt to fix today's RTP access changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/udp.c

    rcecc208 r6a60406  
    101101 
    102102static block_t *BlockUDP( access_t * ); 
    103 static block_t *BlockPrebufferRTP( access_t *p_access, block_t *p_block ); 
     103static block_t *BlockStartRTP( access_t * ); 
    104104static block_t *BlockRTP( access_t * ); 
    105105static block_t *BlockChoose( access_t * ); 
     
    136136    /* Set up p_access */ 
    137137    access_InitFields( p_access ); 
    138     ACCESS_SET_CALLBACKS( NULL, BlockPrebufferRTP, Control, NULL ); 
     138    ACCESS_SET_CALLBACKS( NULL, BlockStartRTP, Control, NULL ); 
    139139    p_access->info.b_prebuffered = VLC_FALSE; 
    140140    MALLOC_ERR( p_access->p_sys, access_sys_t ); p_sys = p_access->p_sys; 
     
    527527 
    528528    /* FIXME: use rtpmap */ 
     529    const char *psz_demux = NULL; 
     530 
    529531    switch( i_payload_type ) 
    530532    { 
    531533        case 14: // MPA: MPEG Audio (RFC2250, §3.4) 
    532534            i_skip += 4; // 32 bits RTP/MPA header 
     535            psz_demux = "mpga"; 
    533536            break; 
    534537 
     
    542545                /* TODO: shouldn't we skip this too ? */ 
    543546            } 
     547            psz_demux = "mpgv"; 
    544548            break; 
    545549 
    546550        case 33: // MP2: MPEG TS (RFC2250, §2) 
    547551            /* plain TS over RTP */ 
     552            psz_demux = "ts"; 
    548553            break; 
    549554 
     
    582587#endif 
    583588 
     589    if( !p_access->psz_demux || !*p_access->psz_demux ) 
     590    { 
     591        free( p_access->psz_demux ); 
     592        p_access->psz_demux = strdup( psz_demux ); 
     593    } 
     594 
    584595    return p_block; 
    585596 
     
    587598    block_Release( p_block ); 
    588599    return NULL; 
     600} 
     601 
     602/***************************************************************************** 
     603 * BlockRTP: receives an RTP packet, parses it, queues it queue, 
     604 * then dequeues the oldest packet and returns it to input/demux. 
     605 ****************************************************************************/ 
     606static block_t *BlockRTP( access_t *p_access ) 
     607{ 
     608    access_sys_t *p_sys = p_access->p_sys; 
     609    block_t *p; 
     610 
     611    while ( !p_sys->p_list || 
     612             ( mdate() - p_sys->p_list->i_pts ) < p_sys->i_rtp_late ) 
     613    { 
     614        p = BlockParseRTP( p_access, 
     615                           p_sys->b_framed_rtp ? BlockTCP( p_access ) 
     616                                               : BlockUDP( p_access ) ); 
     617        if ( !p ) 
     618            return NULL; 
     619 
     620        rtp_ChainInsert( p_access, p ); 
     621    } 
     622 
     623    p = p_sys->p_list; 
     624    p_sys->p_list = p_sys->p_list->p_next; 
     625    p_sys->i_last_seqno++; 
     626    if( p_sys->i_last_seqno != (uint16_t) p->i_dts ) 
     627    { 
     628        msg_Dbg( p_access, "RTP: packet(s) lost, expected %d, got %d", 
     629                 p_sys->i_last_seqno, (uint16_t) p->i_dts ); 
     630        p_sys->i_last_seqno = (uint16_t) p->i_dts; 
     631    } 
     632    p->p_next = NULL; 
     633    return p; 
    589634} 
    590635 
     
    632677} 
    633678 
    634 /***************************************************************************** 
    635  * BlockRTP: receives an RTP packet, parses it, queues it queue, 
    636  * then dequeues the oldest packet and returns it to input/demux. 
    637  ****************************************************************************/ 
    638 static block_t *BlockRTP( access_t *p_access ) 
    639 
    640     access_sys_t *p_sys = p_access->p_sys; 
    641     block_t *p; 
    642  
    643     while ( !p_sys->p_list || 
    644              ( mdate() - p_sys->p_list->i_pts ) < p_sys->i_rtp_late ) 
    645     { 
    646         p = BlockParseRTP( p_access, 
    647                            p_sys->b_framed_rtp ? BlockTCP( p_access ) 
    648                                                : BlockUDP( p_access ) ); 
    649         if ( !p ) 
    650             return NULL; 
    651  
    652         rtp_ChainInsert( p_access, p ); 
    653     } 
    654  
    655     p = p_sys->p_list; 
    656     p_sys->p_list = p_sys->p_list->p_next; 
    657     p_sys->i_last_seqno++; 
    658     if( p_sys->i_last_seqno != (uint16_t) p->i_dts ) 
    659     { 
    660         msg_Dbg( p_access, "RTP: packet(s) lost, expected %d, got %d", 
    661                  p_sys->i_last_seqno, (uint16_t) p->i_dts ); 
    662         p_sys->i_last_seqno = (uint16_t) p->i_dts; 
    663     } 
    664     p->p_next = NULL; 
    665     return p; 
    666 
     679static block_t *BlockStartRTP( access_t *p_access ) 
     680
     681    return BlockPrebufferRTP( p_access, BlockUDP( p_access ) ); 
     682
     683 
    667684 
    668685/*****************************************************************************