summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-15 15:54:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-15 16:08:36 +0200
commit09450c55092523d073f7ec415f863531838ca908 (patch)
tree68ae6a041c8bdb68ad5942b3b5f7f0e6bde23d0c /libavcodec
parent620e7f0f3b3dff85d9c49a5c4b8a5df7143af7fe (diff)
downloadffmpeg-streaming-09450c55092523d073f7ec415f863531838ca908.zip
ffmpeg-streaming-09450c55092523d073f7ec415f863531838ca908.tar.gz
avcodec/h264: fix time_base and framerate
They are not just inverses of each other. This should restore behavior to before the introduction of framerate Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c6
-rw-r--r--libavcodec/h264_parser.c2
-rw-r--r--libavcodec/h264_slice.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6aa174d..0405779 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -688,10 +688,10 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
ff_h264_reset_sei(h);
if (avctx->codec_id == AV_CODEC_ID_H264) {
if (avctx->ticks_per_frame == 1) {
- if(h->avctx->framerate.num < INT_MAX/2) {
- h->avctx->framerate.num *= 2;
+ if(h->avctx->time_base.den < INT_MAX/2) {
+ h->avctx->time_base.den *= 2;
} else
- h->avctx->framerate.den /= 2;
+ h->avctx->time_base.num /= 2;
}
avctx->ticks_per_frame = 2;
}
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 36cf980..ac4d73a 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -490,6 +490,8 @@ static int h264_parse(AVCodecParserContext *s,
parse_nal_units(s, avctx, buf, buf_size);
+ if (avctx->framerate.num)
+ avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
if (h->sei_cpb_removal_delay >= 0) {
s->dts_sync_point = h->sei_buffering_period_present;
s->dts_ref_dts_delta = h->sei_cpb_removal_delay;
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 64aebfa..17c7b47 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1171,7 +1171,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
if (h->x264_build < 44U)
den *= 2;
av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num,
- h->sps.num_units_in_tick, den, 1 << 30);
+ h->sps.num_units_in_tick * h->avctx->ticks_per_frame, den, 1 << 30);
}
if (reinit)
OpenPOWER on IntegriCloud