Message ID | AM7PR03MB6660004178C415FB2EF20D778FC39@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | 3f938cd46a8ae1e66569ec322e8ad56c055726a6 |
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: > The av1_merge_frame BSF outputs its cached data when it sees the > beginning of a new frame, i.e. when it sees a temporal delimiter OBU. > Therefore it typically has a temporal delimiter OBU cached after > outputting a packet. > > This implies that the OBU demuxer must flush its BSF upon seeking > because otherwise the first frame returned after a seek consists > of an old temporal delimiter OBU only. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > The AV1 Annex B demuxer also has two issues: It records the wrong > positions (it is off due to the annex b packetization) and it needs to > flush the bsf, too. Will look into it. > > libavformat/av1dec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c > index d5d4548d8b..88a3c325e4 100644 > --- a/libavformat/av1dec.c > +++ b/libavformat/av1dec.c > @@ -390,6 +390,10 @@ static int obu_read_packet(AVFormatContext *s, AVPacket *pkt) > AV1DemuxContext *const c = s->priv_data; > int ret; > > + if (s->io_repositioned) { > + av_bsf_flush(c->bsf); > + s->io_repositioned = 0; > + } > while (1) { > ret = obu_get_packet(s, pkt); > /* In case of AVERROR_EOF we need to flush the BSF. Conveniently LGTM.
diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c index d5d4548d8b..88a3c325e4 100644 --- a/libavformat/av1dec.c +++ b/libavformat/av1dec.c @@ -390,6 +390,10 @@ static int obu_read_packet(AVFormatContext *s, AVPacket *pkt) AV1DemuxContext *const c = s->priv_data; int ret; + if (s->io_repositioned) { + av_bsf_flush(c->bsf); + s->io_repositioned = 0; + } while (1) { ret = obu_get_packet(s, pkt); /* In case of AVERROR_EOF we need to flush the BSF. Conveniently
The av1_merge_frame BSF outputs its cached data when it sees the beginning of a new frame, i.e. when it sees a temporal delimiter OBU. Therefore it typically has a temporal delimiter OBU cached after outputting a packet. This implies that the OBU demuxer must flush its BSF upon seeking because otherwise the first frame returned after a seek consists of an old temporal delimiter OBU only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- The AV1 Annex B demuxer also has two issues: It records the wrong positions (it is off due to the annex b packetization) and it needs to flush the bsf, too. Will look into it. libavformat/av1dec.c | 4 ++++ 1 file changed, 4 insertions(+)