[FFmpeg-cvslog] rtpenc: base max_frames_per_packet on avg_frame_rate, not codec timebase

Anton Khirnov git at videolan.org
Wed Jun 18 17:27:45 CEST 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu May 29 07:58:35 2014 +0200| [cfbdd7ffbd9fe14d110fd1bb89bf52f0f7bde016] | committer: Anton Khirnov

rtpenc: base max_frames_per_packet on avg_frame_rate, not codec timebase

Fall back to 1 (which is what is used for most cases anyway) when the
framerate is not set.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfbdd7ffbd9fe14d110fd1bb89bf52f0f7bde016
---

 libavformat/rtpenc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 83167eb..0027abd 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -165,7 +165,12 @@ static int rtp_write_header(AVFormatContext *s1)
         }
         if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
             /* FIXME: We should round down here... */
-            s->max_frames_per_packet = av_rescale_q(s1->max_delay, (AVRational){1, 1000000}, st->codec->time_base);
+            if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0) {
+                s->max_frames_per_packet = av_rescale_q(s1->max_delay,
+                                                        (AVRational){1, 1000000},
+                                                        av_inv_q(st->avg_frame_rate));
+            } else
+                s->max_frames_per_packet = 1;
         }
     }
 



More information about the ffmpeg-cvslog mailing list