summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-05-29 07:58:35 +0200
committerAnton Khirnov <anton@khirnov.net>2014-06-18 15:03:16 +0200
commitcfbdd7ffbd9fe14d110fd1bb89bf52f0f7bde016 (patch)
tree52833435591aa109863c0d5b41fe37a6a066c421 /libavformat/rtpenc.c
parent894682a9739eb8d4bfc024b0d4e5757fcfe47378 (diff)
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.
Diffstat (limited to 'libavformat/rtpenc.c')
-rw-r--r--libavformat/rtpenc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 83167eba9c..0027abd421 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;
}
}