diff options
author | John Stebbins <[email protected]> | 2019-05-02 12:56:02 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-05-02 12:58:39 -0600 |
commit | 9be711f822e4458d4d4edda1d00a6b752fc4e7b8 (patch) | |
tree | fe708e0b8ec432d9c2aa81e80893c7ecf2beebd2 /libhb/decavcodec.c | |
parent | 63f8bd872eda9457c0fe63af98cfd6ba334c6658 (diff) |
libhb: pass AV_PKT_FLAG_DISCARD through to decoder
Edit list cuts are not always on keyframe boundaries and therefore
sometimes require dropping frames after decoding them.
AV_PKT_FLAG_DISCARD tells us when to do this.
Fixes https://github.com/HandBrake/HandBrake/issues/1900
Diffstat (limited to 'libhb/decavcodec.c')
-rw-r--r-- | libhb/decavcodec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 6fcdefa9d..610f9ecfa 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -82,6 +82,7 @@ typedef struct int frametype; int scr_sequence; int new_chap; + int discard; } packet_info_t; typedef struct reordered_data_s reordered_data_t; @@ -489,6 +490,7 @@ static int decavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in, pv->packet_info.scr_sequence = in->s.scr_sequence; pv->packet_info.new_chap = in->s.new_chap; pv->packet_info.frametype = in->s.frametype; + pv->packet_info.discard = !!(in->s.flags & HB_FLAG_DISCARD); } for (pos = 0; pos < in->size; pos += len) { @@ -522,6 +524,7 @@ static int decavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // decodeAudio that is now finished. The next packet is associated // with the input buffer, so set it's chapter and scr info. pv->packet_info.scr_sequence = in->s.scr_sequence; + pv->packet_info.discard = !!(in->s.flags & HB_FLAG_DISCARD); pv->unfinished = 0; } if (len > 0 && pout_len <= 0) @@ -1319,6 +1322,7 @@ static int decodeFrame( hb_work_private_t * pv, packet_info_t * packet_info ) { avp.flags |= AV_PKT_FLAG_KEY; } + avp.flags |= packet_info->discard * AV_PKT_FLAG_DISCARD; } else { @@ -1748,6 +1752,7 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, pv->packet_info.scr_sequence = in->s.scr_sequence; pv->packet_info.new_chap = in->s.new_chap; pv->packet_info.frametype = in->s.frametype; + pv->packet_info.discard = !!(in->s.flags & HB_FLAG_DISCARD); } for (pos = 0; pos < in->size; pos += len) { @@ -1802,6 +1807,7 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, pv->packet_info.scr_sequence = in->s.scr_sequence; pv->packet_info.new_chap = in->s.new_chap; pv->packet_info.frametype = in->s.frametype; + pv->packet_info.discard = !!(in->s.flags & HB_FLAG_DISCARD); pv->unfinished = 0; } if (len > 0 && pout_len <= 0) @@ -2168,6 +2174,7 @@ static void decodeAudio(hb_work_private_t *pv, packet_info_t * packet_info) avp.size = packet_info->size; avp.pts = packet_info->pts; avp.dts = AV_NOPTS_VALUE; + avp.flags |= packet_info->discard * AV_PKT_FLAG_DISCARD; } else { |