diff mbox series

[FFmpeg-devel,1/2] Fix double write of DASH manifest in streaming mode

Message ID 20210624125808.45663-1-kevin@aiera.com
State Accepted
Commit 3f5d5c1c2dd71d1b4e5fcc0496337d1b224b0794
Headers show
Series [FFmpeg-devel,1/2] Fix double write of DASH manifest in streaming mode
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Kevin LaFlamme June 24, 2021, 12:58 p.m. UTC
When streaming mode is enabled, the DASH manifest is written on the
first packet for the segment so that the segment can be advertised
immediately to clients. It was also still writing the manifest at the
end of the segment leading to two duplicate writes.
---
 libavformat/dashenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Kevin LaFlamme July 14, 2021, 1:52 p.m. UTC | #1
Any feedback on this?
On Jun 24, 2021, 8:58 AM -0400, Kevin LaFlamme <kevin@aiera.com>, wrote:
> When streaming mode is enabled, the DASH manifest is written on the
> first packet for the segment so that the segment can be advertised
> immediately to clients. It was also still writing the manifest at the
> end of the segment leading to two duplicate writes.
> ---
> libavformat/dashenc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index e7a4a3d9e1..2b8fbcbe6e 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -2030,7 +2030,10 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
>
> c->nr_of_streams_flushed = 0;
> }
> - ret = write_manifest(s, final);
> + // In streaming mode the manifest is written at the beginning
> + // of the segment instead
> + if (!c->streaming || final)
> + ret = write_manifest(s, final);
> }
> return ret;
> }
> @@ -2261,7 +2264,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
> // in streaming mode, the segments are available for playing
> // before fully written but the manifest is needed so that
> // clients and discover the segment filenames.
> - if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) {
> + if (c->streaming) {
> write_manifest(s, 0);
> }
>
> --
> 2.31.1
>
Jeyapal, Karthick July 14, 2021, 2:47 p.m. UTC | #2
On 7/14/21, 7:46 PM, "Kevin LaFlamme" <kevin@aiera.com> wrote:

>Any feedback on this?
Thanks for the reminder. I have pushed this patch alone from this series.
I had some concerns on v2 of this series, to which I have replied separately.

Thanks and Regards,
Karthick
>On Jun 24, 2021, 8:58 AM -0400, Kevin LaFlamme <kevin@aiera.com>, wrote:
>> When streaming mode is enabled, the DASH manifest is written on the
>> first packet for the segment so that the segment can be advertised
>> immediately to clients. It was also still writing the manifest at the
>> end of the segment leading to two duplicate writes.
>> ---
>> libavformat/dashenc.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>> index e7a4a3d9e1..2b8fbcbe6e 100644
>> --- a/libavformat/dashenc.c
>> +++ b/libavformat/dashenc.c
>> @@ -2030,7 +2030,10 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
>>
>> c->nr_of_streams_flushed = 0;
>> }
>> - ret = write_manifest(s, final);
>> + // In streaming mode the manifest is written at the beginning
>> + // of the segment instead
>> + if (!c->streaming || final)
>> + ret = write_manifest(s, final);
>> }
>> return ret;
>> }
>> @@ -2261,7 +2264,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
>> // in streaming mode, the segments are available for playing
>> // before fully written but the manifest is needed so that
>> // clients and discover the segment filenames.
>> - if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) {
>> + if (c->streaming) {
>> write_manifest(s, 0);
>> }
>>
>> --
>> 2.31.1
Kevin LaFlamme July 14, 2021, 2:57 p.m. UTC | #3
Thanks! Yes I saw your comment on v2 and agree that patch can be closed/ignored.
On Jul 14, 2021, 10:47 AM -0400, Jeyapal, Karthick <kjeyapal@akamai.com>, wrote:
>
>
> On 7/14/21, 7:46 PM, "Kevin LaFlamme" <kevin@aiera.com> wrote:
>
> > Any feedback on this?
> Thanks for the reminder. I have pushed this patch alone from this series.
> I had some concerns on v2 of this series, to which I have replied separately.
>
> Thanks and Regards,
> Karthick
> > On Jun 24, 2021, 8:58 AM -0400, Kevin LaFlamme <kevin@aiera.com>, wrote:
> > > When streaming mode is enabled, the DASH manifest is written on the
> > > first packet for the segment so that the segment can be advertised
> > > immediately to clients. It was also still writing the manifest at the
> > > end of the segment leading to two duplicate writes.
> > > ---
> > > libavformat/dashenc.c | 7 +++++--
> > > 1 file changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> > > index e7a4a3d9e1..2b8fbcbe6e 100644
> > > --- a/libavformat/dashenc.c
> > > +++ b/libavformat/dashenc.c
> > > @@ -2030,7 +2030,10 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
> > >
> > > c->nr_of_streams_flushed = 0;
> > > }
> > > - ret = write_manifest(s, final);
> > > + // In streaming mode the manifest is written at the beginning
> > > + // of the segment instead
> > > + if (!c->streaming || final)
> > > + ret = write_manifest(s, final);
> > > }
> > > return ret;
> > > }
> > > @@ -2261,7 +2264,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
> > > // in streaming mode, the segments are available for playing
> > > // before fully written but the manifest is needed so that
> > > // clients and discover the segment filenames.
> > > - if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) {
> > > + if (c->streaming) {
> > > write_manifest(s, 0);
> > > }
> > >
> > > --
> > > 2.31.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index e7a4a3d9e1..2b8fbcbe6e 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2030,7 +2030,10 @@  static int dash_flush(AVFormatContext *s, int final, int stream)
 
             c->nr_of_streams_flushed = 0;
         }
-        ret = write_manifest(s, final);
+        // In streaming mode the manifest is written at the beginning
+        // of the segment instead
+        if (!c->streaming || final)
+            ret = write_manifest(s, final);
     }
     return ret;
 }
@@ -2261,7 +2264,7 @@  static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
         // in streaming mode, the segments are available for playing
         // before fully written but the manifest is needed so that
         // clients and discover the segment filenames.
-        if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) {
+        if (c->streaming) {
             write_manifest(s, 0);
         }