Message ID | AM7PR03MB66603DA06801D32B5B677A678FC39@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | 5a3385d49a765a9cf6d55ecc0826e48d2bf082de |
Headers | show |
Series | [FFmpeg-devel,1/5] avformat/av1dec: Set position of AVPackets given to BSF | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On 8/22/2021 8:29 AM, Andreas Rheinhardt wrote: > This is needed by the AV1-Annex B and AV1-OBU demuxers. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/av1_frame_merge_bsf.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/av1_frame_merge_bsf.c b/libavcodec/av1_frame_merge_bsf.c > index fce5bdb67e..19b9cd01a8 100644 > --- a/libavcodec/av1_frame_merge_bsf.c > +++ b/libavcodec/av1_frame_merge_bsf.c > @@ -103,10 +103,15 @@ eof: > err = AVERROR(EAGAIN); > } > > - // Buffer packets with timestamps. There should be at most one per TU, be it split or not. > - if (!buffer_pkt->data && in->pts != AV_NOPTS_VALUE) > + /* Buffer packets with timestamps (there should be at most one per TU) > + * or any packet if buffer_pkt is empty. The latter is needed to > + * passthrough positions in case there are no timestamps like with > + * the raw OBU demuxer. */ > + if (!buffer_pkt->data || > + in->pts != AV_NOPTS_VALUE && buffer_pkt->pts == AV_NOPTS_VALUE) { > + av_packet_unref(buffer_pkt); > av_packet_move_ref(buffer_pkt, in); > - else > + } else > av_packet_unref(in); > > ff_cbs_fragment_reset(&ctx->frag[ctx->idx]); > Should be ok.
diff --git a/libavcodec/av1_frame_merge_bsf.c b/libavcodec/av1_frame_merge_bsf.c index fce5bdb67e..19b9cd01a8 100644 --- a/libavcodec/av1_frame_merge_bsf.c +++ b/libavcodec/av1_frame_merge_bsf.c @@ -103,10 +103,15 @@ eof: err = AVERROR(EAGAIN); } - // Buffer packets with timestamps. There should be at most one per TU, be it split or not. - if (!buffer_pkt->data && in->pts != AV_NOPTS_VALUE) + /* Buffer packets with timestamps (there should be at most one per TU) + * or any packet if buffer_pkt is empty. The latter is needed to + * passthrough positions in case there are no timestamps like with + * the raw OBU demuxer. */ + if (!buffer_pkt->data || + in->pts != AV_NOPTS_VALUE && buffer_pkt->pts == AV_NOPTS_VALUE) { + av_packet_unref(buffer_pkt); av_packet_move_ref(buffer_pkt, in); - else + } else av_packet_unref(in); ff_cbs_fragment_reset(&ctx->frag[ctx->idx]);
This is needed by the AV1-Annex B and AV1-OBU demuxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/av1_frame_merge_bsf.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)