]> git.sesse.net Git - vlc/blob - modules/access/udp.c
Mark EOF in case of connection-orinted RTP transport
[vlc] / modules / access / udp.c
1 /*****************************************************************************
2  * udp.c: raw UDP & RTP input module
3  *****************************************************************************
4  * Copyright (C) 2001-2005 the VideoLAN team
5  * Copyright (C) 2007 Remi Denis-Courmont
6  * $Id$
7  *
8  * Authors: Christophe Massiot <massiot@via.ecp.fr>
9  *          Tristan Leteurtre <tooney@via.ecp.fr>
10  *          Laurent Aimar <fenrir@via.ecp.fr>
11  *          Jean-Paul Saman <jpsaman #_at_# m2x dot nl>
12  *          Remi Denis-Courmont
13  *
14  * Reviewed: 23 October 2003, Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
29  *****************************************************************************/
30
31 /*****************************************************************************
32  * Preamble
33  *****************************************************************************/
34 #include <stdlib.h>
35
36 #include <vlc/vlc.h>
37 #include <vlc_access.h>
38 #include <vlc_network.h>
39
40 #if defined (HAVE_NETINET_UDPLITE_H)
41 # include <netinet/udplite.h>
42 #elif defined (__linux__)
43 # define UDPLITE_SEND_CSCOV     10
44 # define UDPLITE_RECV_CSCOV     11
45 #endif
46
47 #ifndef IPPROTO_UDPLITE
48 # define IPPROTO_UDPLITE 136 /* from IANA */
49 #endif
50 #ifndef SOL_UDPLITE
51 # define SOL_UDPLITE IPPROTO_UDPLITE
52 #endif
53
54
55 /*****************************************************************************
56  * Module descriptor
57  *****************************************************************************/
58 #define CACHING_TEXT N_("Caching value in ms")
59 #define CACHING_LONGTEXT N_( \
60     "Caching value for UDP streams. This " \
61     "value should be set in milliseconds." )
62
63 #define AUTO_MTU_TEXT N_("Autodetection of MTU")
64 #define AUTO_MTU_LONGTEXT N_( \
65     "Automatically detect the line's MTU. This will increase the size if" \
66     " truncated packets are found" )
67
68 #define RTP_LATE_TEXT N_("RTP reordering timeout in ms")
69 #define RTP_LATE_LONGTEXT N_( \
70     "VLC reorders RTP packets. The input will wait for late packets at most "\
71     "the time specified here (in milliseconds)." )
72
73 static int  Open ( vlc_object_t * );
74 static void Close( vlc_object_t * );
75
76 vlc_module_begin();
77     set_shortname( _("UDP/RTP" ) );
78     set_description( _("UDP/RTP input") );
79     set_category( CAT_INPUT );
80     set_subcategory( SUBCAT_INPUT_ACCESS );
81
82     add_integer( "udp-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
83                  CACHING_LONGTEXT, VLC_TRUE );
84     add_integer( "rtp-late", 100, NULL, RTP_LATE_TEXT, RTP_LATE_LONGTEXT, VLC_TRUE );
85
86     add_bool( "udp-auto-mtu", 1, NULL,
87               AUTO_MTU_TEXT, AUTO_MTU_LONGTEXT, VLC_TRUE );
88
89     set_capability( "access2", 0 );
90     add_shortcut( "udp" );
91     add_shortcut( "udpstream" );
92     add_shortcut( "udp4" );
93     add_shortcut( "udp6" );
94     add_shortcut( "rtp" );
95     add_shortcut( "rtp4" );
96     add_shortcut( "rtp6" );
97     add_shortcut( "udplite" );
98     add_shortcut( "rtptcp" );
99
100     set_callbacks( Open, Close );
101 vlc_module_end();
102
103 /*****************************************************************************
104  * Local prototypes
105  *****************************************************************************/
106 #define RTP_HEADER_LEN 12
107
108 static block_t *BlockUDP( access_t * );
109 static block_t *BlockTCP( access_t * );
110 static block_t *BlockRTP( access_t * );
111 static block_t *BlockChoose( access_t * );
112 static int Control( access_t *, int, va_list );
113
114 struct access_sys_t
115 {
116     int fd;
117
118     int i_mtu;
119     vlc_bool_t b_auto_mtu;
120     vlc_bool_t b_framed_rtp;
121
122     /* reorder rtp packets when out-of-sequence */
123     uint16_t i_last_seqno;
124     mtime_t i_rtp_late;
125     block_t *p_list;
126     block_t *p_end;
127     block_t *p_partial_frame; /* Partial Framed RTP packet */
128 };
129
130 /*****************************************************************************
131  * Open: open the socket
132  *****************************************************************************/
133 static int Open( vlc_object_t *p_this )
134 {
135     access_t     *p_access = (access_t*)p_this;
136     access_sys_t *p_sys;
137
138     char *psz_name = strdup( p_access->psz_path );
139     char *psz_parser;
140     const char *psz_server_addr, *psz_bind_addr = "";
141     int  i_bind_port, i_server_port = 0;
142     int fam = AF_UNSPEC, proto = IPPROTO_UDP;
143     vlc_bool_t b_framed = VLC_FALSE;
144
145     if (strlen (p_access->psz_access) >= 3)
146     {
147         switch (p_access->psz_access[3])
148         {
149             case '4':
150                 fam = AF_INET;
151                 break;
152
153             case '6':
154                 fam = AF_INET6;
155                 break;
156         }
157         if (strcmp (p_access->psz_access + 3, "lite") == 0)
158             proto = IPPROTO_UDPLITE;
159         if (strcmp (p_access->psz_access + 3, "tcp") == 0)
160         {
161             proto = IPPROTO_TCP;
162             b_framed = VLC_TRUE;
163         }
164     }
165
166     i_bind_port = var_CreateGetInteger( p_access, "server-port" );
167
168     /* Parse psz_name syntax :
169      * [serveraddr[:serverport]][@[bindaddr]:[bindport]] */
170     psz_parser = strchr( psz_name, '@' );
171     if( psz_parser != NULL )
172     {
173         /* Found bind address and/or bind port */
174         *psz_parser++ = '\0';
175         psz_bind_addr = psz_parser;
176
177         if( *psz_parser == '[' )
178             /* skips bracket'd IPv6 address */
179             psz_parser = strchr( psz_parser, ']' );
180
181         if( psz_parser != NULL )
182         {
183             psz_parser = strchr( psz_parser, ':' );
184             if( psz_parser != NULL )
185             {
186                 *psz_parser++ = '\0';
187                 i_bind_port = atoi( psz_parser );
188             }
189         }
190     }
191
192     psz_server_addr = psz_name;
193     if( *psz_server_addr == '[' )
194         /* skips bracket'd IPv6 address */
195         psz_parser = strchr( psz_name, ']' );
196
197     if( psz_parser != NULL )
198     {
199         psz_parser = strchr( psz_parser, ':' );
200         if( psz_parser != NULL )
201         {
202             *psz_parser++ = '\0';
203             i_server_port = atoi( psz_parser );
204         }
205     }
206
207     msg_Dbg( p_access, "opening server=%s:%d local=%s:%d",
208              psz_server_addr, i_server_port, psz_bind_addr, i_bind_port );
209
210     /* Set up p_access */
211     access_InitFields( p_access );
212     ACCESS_SET_CALLBACKS( NULL, BlockChoose, Control, NULL );
213     p_access->info.b_prebuffered = VLC_FALSE;
214     MALLOC_ERR( p_access->p_sys, access_sys_t ); p_sys = p_access->p_sys;
215
216     p_sys->fd = b_framed
217               ? net_ConnectTCP( p_access, psz_server_addr, i_server_port )
218               : net_OpenDgram( p_access, psz_bind_addr, i_bind_port,
219                                psz_server_addr, i_server_port, fam, proto );
220     free (psz_name);
221     if( p_sys->fd == -1 )
222     {
223         msg_Err( p_access, "cannot open socket" );
224         free( p_sys );
225         return VLC_EGENERIC;
226     }
227
228     net_StopSend( p_sys->fd );
229
230 #ifdef UDPLITE_RECV_CSCOV
231     if (proto == IPPROTO_UDPLITE)
232         /* UDP header: 8 bytes + RTP header: 12 bytes (or more) */
233         setsockopt (p_sys->fd, SOL_UDPLITE, UDPLITE_RECV_CSCOV,
234                     &(int){ 20 }, sizeof (int));
235 #endif
236
237     p_sys->b_framed_rtp = b_framed;
238     if (b_framed)
239     {
240         /* We don't do autodetection and prebuffering in case of framing */
241         p_access->pf_block = BlockRTP;
242         p_sys->i_mtu = 65535;
243     }
244     else
245     {
246         /* FIXME */
247         p_sys->i_mtu = var_CreateGetInteger( p_access, "mtu" );
248         if( p_sys->i_mtu <= 1 )
249             p_sys->i_mtu  = 1500;   /* Avoid problem */
250
251         p_sys->b_auto_mtu = var_CreateGetBool( p_access, "udp-auto-mtu" );;
252     }
253
254     /* Update default_pts to a suitable value for udp access */
255     var_Create( p_access, "udp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
256
257     /* RTP reordering for out-of-sequence packets */
258     p_sys->i_rtp_late = var_CreateGetInteger( p_access, "rtp-late" ) * 1000;
259     p_sys->i_last_seqno = 0;
260     p_sys->p_list = NULL;
261     p_sys->p_end = NULL;
262     return VLC_SUCCESS;
263 }
264
265 /*****************************************************************************
266  * Close: free unused data structures
267  *****************************************************************************/
268 static void Close( vlc_object_t *p_this )
269 {
270     access_t     *p_access = (access_t*)p_this;
271     access_sys_t *p_sys = p_access->p_sys;
272
273     block_ChainRelease( p_sys->p_list );
274     net_Close( p_sys->fd );
275     free( p_sys );
276 }
277
278 /*****************************************************************************
279  * Control:
280  *****************************************************************************/
281 static int Control( access_t *p_access, int i_query, va_list args )
282 {
283     access_sys_t *p_sys = p_access->p_sys;
284     vlc_bool_t   *pb_bool;
285     int          *pi_int;
286     int64_t      *pi_64;
287
288     switch( i_query )
289     {
290         /* */
291         case ACCESS_CAN_SEEK:
292         case ACCESS_CAN_FASTSEEK:
293         case ACCESS_CAN_PAUSE:
294         case ACCESS_CAN_CONTROL_PACE:
295             pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
296             *pb_bool = VLC_FALSE;
297             break;
298         /* */
299         case ACCESS_GET_MTU:
300             pi_int = (int*)va_arg( args, int * );
301             *pi_int = p_sys->i_mtu;
302             break;
303
304         case ACCESS_GET_PTS_DELAY:
305             pi_64 = (int64_t*)va_arg( args, int64_t * );
306             *pi_64 = var_GetInteger( p_access, "udp-caching" ) * 1000;
307             break;
308
309         /* */
310         case ACCESS_SET_PAUSE_STATE:
311         case ACCESS_GET_TITLE_INFO:
312         case ACCESS_SET_TITLE:
313         case ACCESS_SET_SEEKPOINT:
314         case ACCESS_SET_PRIVATE_ID_STATE:
315             return VLC_EGENERIC;
316
317         default:
318             msg_Warn( p_access, "unimplemented query in control" );
319             return VLC_EGENERIC;
320
321     }
322     return VLC_SUCCESS;
323 }
324
325 /*****************************************************************************
326  * BlockUDP:
327  *****************************************************************************/
328 static block_t *BlockUDP( access_t *p_access )
329 {
330     access_sys_t *p_sys = p_access->p_sys;
331     block_t      *p_block;
332
333     /* Read data */
334     p_block = block_New( p_access, p_sys->i_mtu );
335     p_block->i_buffer = net_Read( p_access, p_sys->fd, NULL,
336                                   p_block->p_buffer, p_sys->i_mtu,
337                                   VLC_FALSE );
338     if( p_block->i_buffer < 0 )
339     {
340         block_Release( p_block );
341         return NULL;
342     }
343
344     if( (p_block->i_buffer >= p_sys->i_mtu) && p_sys->b_auto_mtu &&
345         p_sys->i_mtu < 32767 )
346     {
347         /* Increase by 100% */
348         p_sys->i_mtu *= 2;
349         msg_Dbg( p_access, "increasing MTU to %d", p_sys->i_mtu );
350     }
351
352     return p_block;
353 }
354
355 /*****************************************************************************
356  * BlockTCP: Framed RTP/AVP packet reception for COMEDIA
357  * Still an I-D (draft-ietf-avt-rtp-framing-contrans-06) - subject to change.
358  *****************************************************************************/
359 static block_t *BlockTCP( access_t *p_access )
360 {
361     access_sys_t *p_sys = p_access->p_sys;
362     block_t      *p_block = p_sys->p_partial_frame;
363
364     if( p_access->info.b_eof )
365         return NULL;
366
367     if( p_block == NULL )
368     {
369         /* MTU should always be 65535 in this case */
370         p_sys->p_partial_frame = p_block = block_New( p_access, 65537 );
371         if (p_block == NULL)
372             return NULL;
373     }
374
375     /* Read RTP framing */
376     if (p_block->i_buffer < 2)
377     {
378         /* FIXME: not very efficient */
379         int i_read = net_Read( p_access, p_sys->fd, NULL,
380                                p_block->p_buffer + p_block->i_buffer,
381                                2 - p_block->i_buffer, VLC_FALSE );
382         if( i_read <= 0 )
383             goto error;
384
385         p_block->i_buffer += i_read;
386         if (p_block->i_buffer < 2)
387             return NULL;
388     }
389
390     uint16_t framelen = GetWLE( p_block->p_buffer );
391     /* Read RTP frame */
392     if( framelen > 0 )
393     {
394         int i_read = net_Read( p_access, p_sys->fd, NULL,
395                                p_block->p_buffer + p_block->i_buffer,
396                                2 + framelen - p_block->i_buffer, VLC_FALSE );
397         if( i_read <= 0 )
398             goto error;
399
400         p_block->i_buffer += i_read;
401     }
402
403     if( p_block->i_buffer < (2 + framelen) )
404         return NULL; // incomplete frame
405
406     /* Hide framing from RTP layer */
407     p_block->p_buffer += 2;
408     p_block->i_buffer -= 2;
409     p_sys->p_partial_frame = NULL;
410     return p_block;
411
412 error:
413     p_access->info.b_eof = VLC_TRUE;
414     block_Release( p_block );
415     p_sys->p_partial_frame = NULL;
416     return NULL;
417 }
418
419
420 /*
421  * rtp_ChainInsert - insert a p_block in the chain and
422  * look at the sequence numbers.
423  */
424 static inline vlc_bool_t rtp_ChainInsert( access_t *p_access, block_t *p_block )
425 {
426     access_sys_t *p_sys = (access_sys_t *) p_access->p_sys;
427     block_t *p_prev = NULL;
428     block_t *p = p_sys->p_end;
429     uint16_t i_new = (uint16_t) p_block->i_dts;
430     uint16_t i_tmp = 0;
431
432     if( !p_sys->p_list )
433     {
434         p_sys->p_list = p_block;
435         p_sys->p_end = p_block;
436         return VLC_TRUE;
437     }
438     /* walk through the queue from top down since the new packet is in 
439     most cases just appended to the end */
440
441     for( ;; )
442     {
443         i_tmp = i_new - (uint16_t) p->i_dts;
444
445         if( !i_tmp )   /* trash duplicate */
446             break; 
447
448         if ( i_tmp < 32768 )
449         {   /* insert after this block ( i_new > p->i_dts ) */
450             p_block->p_next = p->p_next;
451             p->p_next = p_block;
452             p_block->p_prev = p;
453             if (p_prev)
454             {
455                 p_prev->p_prev = p_block;
456                 msg_Dbg(p_access, "RTP reordering: insert after %d, new %d", 
457                     (uint16_t) p->i_dts, i_new );
458             }
459             else 
460             {
461                 p_sys->p_end = p_block;
462             }
463             return VLC_TRUE;
464         }
465         if( p == p_sys->p_list )
466         {   /* we've reached bottom of chain */
467             i_tmp = p_sys->i_last_seqno - i_new;
468             if( !p_access->info.b_prebuffered || (i_tmp > 32767) )
469             {
470                 msg_Dbg(p_access, "RTP reordering: prepend %d before %d", 
471                         i_new, (uint16_t) p->i_dts );
472                 p_block->p_next = p;
473                 p->p_prev = p_block;
474                 p_sys->p_list = p_block;
475                 return VLC_TRUE;
476             }
477
478             if( !i_tmp )   /* trash duplicate */
479                 break;
480
481             /* reordering failed - append the packet to the end of queue */
482             msg_Dbg(p_access, "RTP: sequence changed (or buffer too small) "
483                 "new: %d, buffer %d...%d", i_new, (uint16_t) p->i_dts, 
484                 (uint16_t) p_sys->p_end->i_dts);
485             p_sys->p_end->p_next = p_block;
486             p_block->p_prev = p_sys->p_end;
487             p_sys->p_end = p_block;
488             return VLC_TRUE;
489         }
490         p_prev = p;
491         p = p->p_prev;
492     }
493     block_Release( p_block );
494     return VLC_FALSE;
495 }
496
497 /*****************************************************************************
498  * BlockParseRTP/BlockRTP:
499  *****************************************************************************/
500 static block_t *BlockParseRTP( access_t *p_access, block_t *p_block )
501 {
502     int      i_rtp_version;
503     int      i_CSRC_count;
504     int      i_payload_type;
505     int      i_skip = 0;
506     int      i_extension_flag = 0;
507     int      i_extension_length = 0;
508     uint16_t i_sequence_number = 0;
509
510     if( p_block == NULL )
511         return NULL;
512
513     if( p_block->i_buffer < RTP_HEADER_LEN )
514         goto trash;
515
516     /* Parse the header and make some verifications.
517      * See RFC 3550. */
518     i_rtp_version     = ( p_block->p_buffer[0] & 0xC0 ) >> 6;
519     i_CSRC_count      = p_block->p_buffer[0] & 0x0F;
520     i_extension_flag  = p_block->p_buffer[0] & 0x10;
521     i_payload_type    = p_block->p_buffer[1] & 0x7F;
522     i_sequence_number = (p_block->p_buffer[2] << 8 ) + p_block->p_buffer[3];
523
524     if( i_rtp_version != 2 )
525         msg_Dbg( p_access, "RTP version is %u, should be 2", i_rtp_version );
526
527     if( i_payload_type == 14 || i_payload_type == 32)
528         i_skip = 4;
529     else if( i_payload_type !=  33 )
530         msg_Dbg( p_access, "unsupported RTP payload type (%u)", i_payload_type );
531     if( i_extension_flag )
532     {
533         if( p_block->i_buffer < 16 )
534             goto trash;
535         i_extension_length = 4 +
536             4 * ( (p_block->p_buffer[14] << 8) + p_block->p_buffer[15] );
537     }
538
539     /* Skip header + CSRC extension field n*(32 bits) + extension */
540     i_skip += RTP_HEADER_LEN + 4*i_CSRC_count + i_extension_length;
541
542     if( i_skip >= p_block->i_buffer )
543         goto trash;
544
545     /* Return the packet without the RTP header, remember seqno in i_dts */
546     p_block->i_buffer -= i_skip;
547     p_block->p_buffer += i_skip;
548     p_block->i_pts = mdate();
549     p_block->i_dts = (mtime_t) i_sequence_number;
550
551 #if 0
552     /* Emulate packet loss */
553     if ( (i_sequence_number % 4000) == 0)
554     {
555         msg_Warn( p_access, "Emulating packet drop" );
556         block_Release( p_block );
557         return NULL;
558     }
559 #endif
560
561     return p_block;
562
563 trash:
564     msg_Warn( p_access, "received a too short packet for RTP" );
565     block_Release( p_block );
566     return NULL;
567 }
568
569 static block_t *BlockPrebufferRTP( access_t *p_access, block_t *p_block )
570 {
571     access_sys_t *p_sys = p_access->p_sys;
572     mtime_t   i_first = mdate();
573     int       i_count = 0;
574     block_t   *p = p_block;
575
576     for( ;; )
577     {
578         mtime_t i_date = mdate();
579
580         if( p && rtp_ChainInsert( p_access, p ))
581             i_count++;
582
583         /* Require at least 2 packets in the buffer */
584         if( i_count > 2 && (i_date - i_first) > p_sys->i_rtp_late )
585             break;
586
587         p = BlockParseRTP( p_access, BlockUDP( p_access ) );
588         if( !p && (i_date - i_first) > p_sys->i_rtp_late ) 
589         {
590             msg_Err( p_access, "error in RTP prebuffering!" );
591             break;
592         }
593     }
594
595     msg_Dbg( p_access, "RTP: prebuffered %d packets", i_count - 1 );
596     p_access->info.b_prebuffered = VLC_TRUE;
597     p = p_sys->p_list;
598     p_sys->p_list = p_sys->p_list->p_next;
599     p_sys->i_last_seqno = (uint16_t) p->i_dts;
600     p->p_next = NULL;
601     return p;
602 }
603
604 static block_t *BlockRTP( access_t *p_access )
605 {
606     access_sys_t *p_sys = p_access->p_sys;
607     block_t *p;
608
609     while ( !p_sys->p_list ||
610              ( mdate() - p_sys->p_list->i_pts ) < p_sys->i_rtp_late )
611     {
612         p = BlockParseRTP( p_access,
613                            p_sys->b_framed_rtp ? BlockTCP( p_access )
614                                                : BlockUDP( p_access ) );
615         if ( !p )
616             return NULL;
617
618         rtp_ChainInsert( p_access, p );
619     }
620
621     p = p_sys->p_list;
622     p_sys->p_list = p_sys->p_list->p_next;
623     p_sys->i_last_seqno++;
624     if( p_sys->i_last_seqno != (uint16_t) p->i_dts )
625     {
626         msg_Dbg( p_access, "RTP: packet(s) lost, expected %d, got %d",
627                  p_sys->i_last_seqno, (uint16_t) p->i_dts );
628         p_sys->i_last_seqno = (uint16_t) p->i_dts;
629     }
630     p->p_next = NULL;
631     return p;
632 }
633
634 /*****************************************************************************
635  * BlockChoose: decide between RTP and UDP
636  *****************************************************************************/
637 static block_t *BlockChoose( access_t *p_access )
638 {
639     block_t *p_block;
640     int     i_rtp_version;
641     int     i_CSRC_count;
642     int     i_payload_type;
643
644     if( ( p_block = BlockUDP( p_access ) ) == NULL )
645         return NULL;
646
647     if( p_block->p_buffer[0] == 0x47 )
648     {
649         msg_Dbg( p_access, "detected TS over raw UDP" );
650         p_access->pf_block = BlockUDP;
651         p_access->info.b_prebuffered = VLC_TRUE;
652         return p_block;
653     }
654
655     if( p_block->i_buffer < RTP_HEADER_LEN )
656         return p_block;
657
658     /* Parse the header and make some verifications.
659      * See RFC 3550. */
660
661     i_rtp_version  = ( p_block->p_buffer[0] & 0xC0 ) >> 6;
662     i_CSRC_count   = ( p_block->p_buffer[0] & 0x0F );
663     i_payload_type = ( p_block->p_buffer[1] & 0x7F );
664
665     if( i_rtp_version != 2 )
666     {
667         msg_Dbg( p_access, "no supported RTP header detected" );
668         p_access->pf_block = BlockUDP;
669         p_access->info.b_prebuffered = VLC_TRUE;
670         return p_block;
671     }
672
673     switch( i_payload_type )
674     {
675         case 33:
676             msg_Dbg( p_access, "detected TS over RTP" );
677             p_access->psz_demux = strdup( "ts" );
678             break;
679
680         case 14:
681             msg_Dbg( p_access, "detected MPEG audio over RTP" );
682             p_access->psz_demux = strdup( "mpga" );
683             break;
684
685         case 32:
686             msg_Dbg( p_access, "detected MPEG video over RTP" );
687             p_access->psz_demux = strdup( "mpgv" );
688             break;
689
690         default:
691             msg_Dbg( p_access, "no RTP header detected" );
692             p_access->pf_block = BlockUDP;
693             p_access->info.b_prebuffered = VLC_TRUE;
694             return p_block;
695     }
696
697     if( !BlockParseRTP( p_access, p_block )) return NULL;
698
699     p_access->pf_block = BlockRTP;
700
701     return BlockPrebufferRTP( p_access, p_block );
702 }