diff mbox series

[FFmpeg-devel,1/7] avformat/matroskaenc: Write SeekHead when livestreaming

Message ID 20200428083645.4909-1-andreas.rheinhardt@gmail.com
State Accepted
Commit d13feae0f85bebdd35e44ccbadf974b10dc3cef1
Headers show
Series [FFmpeg-devel,1/7] avformat/matroskaenc: Write SeekHead when livestreaming | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 28, 2020, 8:36 a.m. UTC
Commit 6fd300ac6c2c3871736ce0e6df95603255004dc6 added support for WebM
Chunk livestreaming; in this case, both the header as well as each
Cluster is written to a file of its own, so that even if the AVIOContext
seems seekable, the muxer has to behave as if it were not. Yet one of
the added checks makes no sense: It ensures that no SeekHead is written
preliminarily (and hence no SeekHead is written at all) if the option
for livestreaming is set, although one should write the SeekHead in this
case when writing the Header. E.g. the WebM-DASH specification [1]
never forbids writing a SeekHead and in some instances (that don't apply
here) even requires it (if Cues are written after the Clusters).

[1]: https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt May 2, 2020, 6:14 p.m. UTC | #1
Andreas Rheinhardt:
> Commit 6fd300ac6c2c3871736ce0e6df95603255004dc6 added support for WebM
> Chunk livestreaming; in this case, both the header as well as each
> Cluster is written to a file of its own, so that even if the AVIOContext
> seems seekable, the muxer has to behave as if it were not. Yet one of
> the added checks makes no sense: It ensures that no SeekHead is written
> preliminarily (and hence no SeekHead is written at all) if the option
> for livestreaming is set, although one should write the SeekHead in this
> case when writing the Header. E.g. the WebM-DASH specification [1]
> never forbids writing a SeekHead and in some instances (that don't apply
> here) even requires it (if Cues are written after the Clusters).
> 
> [1]: https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/matroskaenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 784973a951..dd77ae64bc 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -1896,7 +1896,7 @@ static int mkv_write_header(AVFormatContext *s)
>      if (ret < 0)
>          return ret;
>  
> -    if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
> +    if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) || mkv->is_live) {
>          ret = mkv_write_seekhead(pb, mkv, 0, avio_tell(pb));
>          if (ret < 0)
>              return ret;
> 
I intend to apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 784973a951..dd77ae64bc 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1896,7 +1896,7 @@  static int mkv_write_header(AVFormatContext *s)
     if (ret < 0)
         return ret;
 
-    if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
+    if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) || mkv->is_live) {
         ret = mkv_write_seekhead(pb, mkv, 0, avio_tell(pb));
         if (ret < 0)
             return ret;