[FFmpeg-devel] [PATCH] avcodec/h264_parser: set missing pts for top/bottom field frames
Michael Niedermayer
michael at niedermayer.cc
Wed Sep 14 18:39:08 EEST 2016
On Wed, Sep 14, 2016 at 04:42:59PM +0200, Paul B Mahol wrote:
> Adopted from 4eb49fdde8f84d54a763cfb5d355527b525ee2bf revert.
>
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavcodec/h264_parser.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
> index 615884f..cf6c3d1 100644
> --- a/libavcodec/h264_parser.c
> +++ b/libavcodec/h264_parser.c
> @@ -60,6 +60,7 @@ typedef struct H264ParseContext {
> uint8_t parse_history[6];
> int parse_history_count;
> int parse_last_mb;
> + int64_t reference_dts;
> } H264ParseContext;
>
>
> @@ -598,6 +599,26 @@ static int h264_parse(AVCodecParserContext *s,
> s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
> }
>
> + if (s->dts_sync_point >= 0) {
> + int64_t den = avctx->time_base.den * avctx->pkt_timebase.num;
> + if (den > 0) {
> + int64_t num = avctx->time_base.num * avctx->pkt_timebase.den;
overflows, needs this:
@@ -600,9 +600,9 @@ static int h264_parse(AVCodecParserContext *s,
}
if (s->dts_sync_point >= 0) {
- int64_t den = avctx->time_base.den * avctx->pkt_timebase.num;
+ int64_t den = avctx->time_base.den * (int64_t)avctx->pkt_timebase.num;
if (den > 0) {
- int64_t num = avctx->time_base.num * avctx->pkt_timebase.den;
+ int64_t num = avctx->time_base.num * (int64_t)avctx->pkt_timebase.den;
if (s->dts != AV_NOPTS_VALUE) {
// got DTS from the stream, update reference timestamp
p->reference_dts = s->dts - s->dts_ref_dts_delta * num / den;
LGTM otherwise
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160914/ef0473bc/attachment.sig>
More information about the ffmpeg-devel
mailing list