Changeset 6a604066e435c727e04726050e2e76c0eebb1797
- 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
| rcecc208 |
r6a60406 |
|
| 101 | 101 | |
|---|
| 102 | 102 | static block_t *BlockUDP( access_t * ); |
|---|
| 103 | | static block_t *BlockPrebufferRTP( access_t *p_access, block_t *p_block ); |
|---|
| | 103 | static block_t *BlockStartRTP( access_t * ); |
|---|
| 104 | 104 | static block_t *BlockRTP( access_t * ); |
|---|
| 105 | 105 | static block_t *BlockChoose( access_t * ); |
|---|
| … | … | |
| 136 | 136 | /* Set up p_access */ |
|---|
| 137 | 137 | access_InitFields( p_access ); |
|---|
| 138 | | ACCESS_SET_CALLBACKS( NULL, BlockPrebufferRTP, Control, NULL ); |
|---|
| | 138 | ACCESS_SET_CALLBACKS( NULL, BlockStartRTP, Control, NULL ); |
|---|
| 139 | 139 | p_access->info.b_prebuffered = VLC_FALSE; |
|---|
| 140 | 140 | MALLOC_ERR( p_access->p_sys, access_sys_t ); p_sys = p_access->p_sys; |
|---|
| … | … | |
| 527 | 527 | |
|---|
| 528 | 528 | /* FIXME: use rtpmap */ |
|---|
| | 529 | const char *psz_demux = NULL; |
|---|
| | 530 | |
|---|
| 529 | 531 | switch( i_payload_type ) |
|---|
| 530 | 532 | { |
|---|
| 531 | 533 | case 14: // MPA: MPEG Audio (RFC2250, §3.4) |
|---|
| 532 | 534 | i_skip += 4; // 32 bits RTP/MPA header |
|---|
| | 535 | psz_demux = "mpga"; |
|---|
| 533 | 536 | break; |
|---|
| 534 | 537 | |
|---|
| … | … | |
| 542 | 545 | /* TODO: shouldn't we skip this too ? */ |
|---|
| 543 | 546 | } |
|---|
| | 547 | psz_demux = "mpgv"; |
|---|
| 544 | 548 | break; |
|---|
| 545 | 549 | |
|---|
| 546 | 550 | case 33: // MP2: MPEG TS (RFC2250, §2) |
|---|
| 547 | 551 | /* plain TS over RTP */ |
|---|
| | 552 | psz_demux = "ts"; |
|---|
| 548 | 553 | break; |
|---|
| 549 | 554 | |
|---|
| … | … | |
| 582 | 587 | #endif |
|---|
| 583 | 588 | |
|---|
| | 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 | |
|---|
| 584 | 595 | return p_block; |
|---|
| 585 | 596 | |
|---|
| … | … | |
| 587 | 598 | block_Release( p_block ); |
|---|
| 588 | 599 | 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 | ****************************************************************************/ |
|---|
| | 606 | static 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; |
|---|
| 589 | 634 | } |
|---|
| 590 | 635 | |
|---|
| … | … | |
| 632 | 677 | } |
|---|
| 633 | 678 | |
|---|
| 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 | | } |
|---|
| | 679 | static block_t *BlockStartRTP( access_t *p_access ) |
|---|
| | 680 | { |
|---|
| | 681 | return BlockPrebufferRTP( p_access, BlockUDP( p_access ) ); |
|---|
| | 682 | } |
|---|
| | 683 | |
|---|
| 667 | 684 | |
|---|
| 668 | 685 | /***************************************************************************** |
|---|