[FFmpeg-devel] [PATCH] libavformat/matroskaenc.c: Check if we can seek before writing the end of the ebml of the segment.
Thierry Foucu
tfoucu at gmail.com
Wed Mar 11 21:15:39 EET 2020
On Wed, Mar 11, 2020 at 10:13 AM Andreas Rheinhardt <
andreas.rheinhardt at gmail.com> wrote:
> Thierry Foucu:
> > ---
> > libavformat/matroskaenc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> > index 42f21eae8b..cf436f9e3e 100644
> > --- a/libavformat/matroskaenc.c
> > +++ b/libavformat/matroskaenc.c
> > @@ -2630,7 +2630,7 @@ static int mkv_write_trailer(AVFormatContext *s)
> > avio_seek(pb, currentpos, SEEK_SET);
> > }
> >
> > - if (!mkv->is_live) {
> > + if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
> > end_ebml_master(pb, mkv->segment);
> > }
> >
> >
> Why? Even if the output is unseekable, the seek to the beginning might
> succeed if it happens in the output buffer (unlikely but possible). Or
> do you have a specific usecase in mind where the segment should be
> unknown-length?
>
>
In most cases in the muxer, we are checking if the file support seeking
before writing some ebml, like we do for the cues in the trailer function.
It is true that in some cases, the offset will be in the output buffer,
then why not as well check it for cues?
but most of the time, this offset will not when we are in streaming more.
Maybe the aviobuf layer should not then call io_seek if the under
layer has is_streamed
= true?
> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
--
Thierry Foucu
More information about the ffmpeg-devel
mailing list