This enables the packet reordering functions by default on
UDP transports.
---
 doc/protocols.texi    |    6 +++---
 libavformat/rtsp.c    |    7 +++++++
 libavformat/rtsp.h    |    3 +++
 libavformat/rtspdec.c |    1 +
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 0eb4c69..b08233e 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -288,9 +288,9 @@ Accept packets only from negotiated peer address and port.
 @end table
 
 When receiving data over UDP, the demuxer tries to reorder received packets
-(since they may arrive out of order, or packets may get lost totally). In
-order for this to be enabled, a maximum delay must be specified in the
-@code{max_delay} field of AVFormatContext.
+(since they may arrive out of order, or packets may get lost totally). This
+can be disabled by setting the maximum demuxing delay to zero (via
+the @code{max_delay} field of AVFormatContext).
 
 When watching multi-bitrate Real-RTSP streams with @file{avplay}, the
 streams to display can be chosen with @code{-vst} @var{n} and
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 56deed3..db3ea1f 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -97,6 +97,11 @@ static const AVOption rtp_options[] = {
     { NULL },
 };
 
+const AVCodecDefault ff_rtsp_defaults[] = {
+    { "max_delay", "100000" }, /* 0.1 s delay, enabling RTP packet reordering 
*/
+    { NULL },
+};
+
 static void get_word_until_chars(char *buf, int buf_size,
                                  const char *sep, const char **pp)
 {
@@ -1930,6 +1935,7 @@ AVInputFormat ff_sdp_demuxer = {
     .read_packet    = ff_rtsp_fetch_packet,
     .read_close     = sdp_read_close,
     .priv_class     = &sdp_demuxer_class,
+    .defaults       = ff_rtsp_defaults,
 };
 #endif /* CONFIG_SDP_DEMUXER */
 
@@ -2049,5 +2055,6 @@ AVInputFormat ff_rtp_demuxer = {
     .read_close     = sdp_read_close,
     .flags          = AVFMT_NOFILE,
     .priv_class     = &rtp_demuxer_class,
+    .defaults       = ff_rtsp_defaults,
 };
 #endif /* CONFIG_RTP_DEMUXER */
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 6872a51..6236a45 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -28,6 +28,7 @@
 #include "network.h"
 #include "httpauth.h"
 
+#include "libavcodec/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 
@@ -555,4 +556,6 @@ void ff_rtsp_undo_setup(AVFormatContext *s);
 
 extern const AVOption ff_rtsp_options[];
 
+extern const AVCodecDefault ff_rtsp_defaults[];
+
 #endif /* AVFORMAT_RTSP_H */
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 9306384..e878aad 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -413,4 +413,5 @@ AVInputFormat ff_rtsp_demuxer = {
     .read_play      = rtsp_read_play,
     .read_pause     = rtsp_read_pause,
     .priv_class     = &rtsp_demuxer_class,
+    .defaults       = ff_rtsp_defaults,
 };
-- 
1.7.3.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to