diff mbox series

[FFmpeg-devel,6/6] avformat/av1dec: Disallow seeking by bytes

Message ID PR3PR03MB6665EED3ECA95439D9B03CFE8FC39@PR3PR03MB6665.eurprd03.prod.outlook.com
State Accepted
Commit 0383ec88a56dcad7b2e87ff243f26d3287ba3fdb
Headers show
Series [FFmpeg-devel,1/5] avformat/av1dec: Set position of AVPackets given to BSF | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 22, 2021, 1:25 p.m. UTC
The low overhead OBU format provides no means to resync after performing
a byte-based seek; in other words: Byte based seeking is just not
supported.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
The reason I didn't disallow this earlier was that there is one scenario
where such a seek would work: When one  already knows the correct
position for the start of a frame. But otherwise it just doesn't work.

Somehow ffplay tries byte based seeking even for formats with the
AVFMT_NO_BYTE_SEEK flag set. Line 2837 should probably be changed to no
longer do that.

 libavformat/av1dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer Aug. 22, 2021, 2:21 p.m. UTC | #1
On 8/22/2021 10:25 AM, Andreas Rheinhardt wrote:
> The low overhead OBU format provides no means to resync after performing
> a byte-based seek; in other words: Byte based seeking is just not
> supported.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> The reason I didn't disallow this earlier was that there is one scenario
> where such a seek would work: When one  already knows the correct
> position for the start of a frame. But otherwise it just doesn't work.
> 
> Somehow ffplay tries byte based seeking even for formats with the
> AVFMT_NO_BYTE_SEEK flag set. Line 2837 should probably be changed to no
> longer do that.
> 
>   libavformat/av1dec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
> index 88a3c325e4..37f21483b9 100644
> --- a/libavformat/av1dec.c
> +++ b/libavformat/av1dec.c
> @@ -428,7 +428,7 @@ const AVInputFormat ff_obu_demuxer = {
>       .read_packet    = obu_read_packet,
>       .read_close     = av1_read_close,
>       .extensions     = "obu",
> -    .flags          = AVFMT_GENERIC_INDEX,
> +    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
>       .priv_class     = &av1_demuxer_class,
>   };
>   #endif

LGTM.

Maybe also AVFMT_NOTIMESTAMPS could be added.
Andreas Rheinhardt Aug. 22, 2021, 2:37 p.m. UTC | #2
James Almer:
> On 8/22/2021 10:25 AM, Andreas Rheinhardt wrote:
>> The low overhead OBU format provides no means to resync after performing
>> a byte-based seek; in other words: Byte based seeking is just not
>> supported.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> The reason I didn't disallow this earlier was that there is one scenario
>> where such a seek would work: When one  already knows the correct
>> position for the start of a frame. But otherwise it just doesn't work.
>>
>> Somehow ffplay tries byte based seeking even for formats with the
>> AVFMT_NO_BYTE_SEEK flag set. Line 2837 should probably be changed to no
>> longer do that.
>>
>>   libavformat/av1dec.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
>> index 88a3c325e4..37f21483b9 100644
>> --- a/libavformat/av1dec.c
>> +++ b/libavformat/av1dec.c
>> @@ -428,7 +428,7 @@ const AVInputFormat ff_obu_demuxer = {
>>       .read_packet    = obu_read_packet,
>>       .read_close     = av1_read_close,
>>       .extensions     = "obu",
>> -    .flags          = AVFMT_GENERIC_INDEX,
>> +    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
>>       .priv_class     = &av1_demuxer_class,
>>   };
>>   #endif
> 
> LGTM.
> 
> Maybe also AVFMT_NOTIMESTAMPS could be added.

But isn't AV1 able to contain timestamps via its timing_info() and
metadata_timecode() structure?

- Andreas
James Almer Aug. 22, 2021, 3 p.m. UTC | #3
On 8/22/2021 11:37 AM, Andreas Rheinhardt wrote:
> James Almer:
>> On 8/22/2021 10:25 AM, Andreas Rheinhardt wrote:
>>> The low overhead OBU format provides no means to resync after performing
>>> a byte-based seek; in other words: Byte based seeking is just not
>>> supported.
>>>
>>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>>> ---
>>> The reason I didn't disallow this earlier was that there is one scenario
>>> where such a seek would work: When one  already knows the correct
>>> position for the start of a frame. But otherwise it just doesn't work.
>>>
>>> Somehow ffplay tries byte based seeking even for formats with the
>>> AVFMT_NO_BYTE_SEEK flag set. Line 2837 should probably be changed to no
>>> longer do that.
>>>
>>>    libavformat/av1dec.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
>>> index 88a3c325e4..37f21483b9 100644
>>> --- a/libavformat/av1dec.c
>>> +++ b/libavformat/av1dec.c
>>> @@ -428,7 +428,7 @@ const AVInputFormat ff_obu_demuxer = {
>>>        .read_packet    = obu_read_packet,
>>>        .read_close     = av1_read_close,
>>>        .extensions     = "obu",
>>> -    .flags          = AVFMT_GENERIC_INDEX,
>>> +    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
>>>        .priv_class     = &av1_demuxer_class,
>>>    };
>>>    #endif
>>
>> LGTM.
>>
>> Maybe also AVFMT_NOTIMESTAMPS could be added.
> 
> But isn't AV1 able to contain timestamps via its timing_info() and
> metadata_timecode() structure?
> 
> - Andreas

But those are not values exported by the demuxer, which is what i 
interpreted the flag is about. But i see other raw demuxers with similar 
codec level timing information that don't set it, so i guess not.
diff mbox series

Patch

diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 88a3c325e4..37f21483b9 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -428,7 +428,7 @@  const AVInputFormat ff_obu_demuxer = {
     .read_packet    = obu_read_packet,
     .read_close     = av1_read_close,
     .extensions     = "obu",
-    .flags          = AVFMT_GENERIC_INDEX,
+    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
     .priv_class     = &av1_demuxer_class,
 };
 #endif