diff mbox

[FFmpeg-devel,2/2] lavf/dashenc: Delete HLS manifests on trailer writing if remove_at_exit is set.

Message ID 20181128113609.16637-2-andrey.semashev@gmail.com
State Accepted
Commit 84c17449ce221c42475403a133e91c7677034c98
Headers show

Commit Message

Andrey Semashev Nov. 28, 2018, 11:36 a.m. UTC
This fixes HLS manifests being left behind if remove_at_exit is set.
---
 libavformat/dashenc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Jeyapal, Karthick Nov. 28, 2018, 4:58 p.m. UTC | #1
On 11/28/18 5:06 PM, Andrey Semashev wrote:
> This fixes HLS manifests being left behind if remove_at_exit is set.

> ---

>  libavformat/dashenc.c | 12 ++++++++++++

>  1 file changed, 12 insertions(+)

>

> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c

> index a7d8c4e237..af3f0ee167 100644

> --- a/libavformat/dashenc.c

> +++ b/libavformat/dashenc.c

> @@ -1619,6 +1619,18 @@ static int dash_write_trailer(AVFormatContext *s)

>              dashenc_delete_file(s, filename);

>          }

>          dashenc_delete_file(s, s->url);

> +

> +        if (c->hls_playlist && c->master_playlist_created) {

> +            for (i = 0; i < s->nb_streams; i++) {

> +                OutputStream *os = &c->streams[i];

> +                if (os->segment_type == SEGMENT_TYPE_MP4) {

> +                    get_hls_playlist_name(filename, sizeof(filename), c->dirname, i);

> +                    dashenc_delete_file(s, filename);

> +                }

> +            }

> +            snprintf(filename, sizeof(filename), "%smaster.m3u8", c->dirname);

> +            dashenc_delete_file(s, filename);

> +        }

>      }

>  

>      return 0;

LGTM

Regards,
Karthick
Jeyapal, Karthick Dec. 2, 2018, 1:40 p.m. UTC | #2
On 11/28/18 10:28 PM, Jeyapal, Karthick wrote:
>

> On 11/28/18 5:06 PM, Andrey Semashev wrote:

>> This fixes HLS manifests being left behind if remove_at_exit is set.

>> ---

>>  libavformat/dashenc.c | 12 ++++++++++++

>>  1 file changed, 12 insertions(+)

>>

>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c

>> index a7d8c4e237..af3f0ee167 100644

>> --- a/libavformat/dashenc.c

>> +++ b/libavformat/dashenc.c

>> @@ -1619,6 +1619,18 @@ static int dash_write_trailer(AVFormatContext *s)

>>              dashenc_delete_file(s, filename);

>>          }

>>          dashenc_delete_file(s, s->url);

>> +

>> +        if (c->hls_playlist && c->master_playlist_created) {

>> +            for (i = 0; i < s->nb_streams; i++) {

>> +                OutputStream *os = &c->streams[i];

>> +                if (os->segment_type == SEGMENT_TYPE_MP4) {

>> +                    get_hls_playlist_name(filename, sizeof(filename), c->dirname, i);

>> +                    dashenc_delete_file(s, filename);

>> +                }

>> +            }

>> +            snprintf(filename, sizeof(filename), "%smaster.m3u8", c->dirname);

>> +            dashenc_delete_file(s, filename);

>> +        }

>>      }

>>  

>>      return 0;

> LGTM

Pushed
>

> Regards,

> Karthick

>

> _______________________________________________

> ffmpeg-devel mailing list

> ffmpeg-devel@ffmpeg.org

> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index a7d8c4e237..af3f0ee167 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1619,6 +1619,18 @@  static int dash_write_trailer(AVFormatContext *s)
             dashenc_delete_file(s, filename);
         }
         dashenc_delete_file(s, s->url);
+
+        if (c->hls_playlist && c->master_playlist_created) {
+            for (i = 0; i < s->nb_streams; i++) {
+                OutputStream *os = &c->streams[i];
+                if (os->segment_type == SEGMENT_TYPE_MP4) {
+                    get_hls_playlist_name(filename, sizeof(filename), c->dirname, i);
+                    dashenc_delete_file(s, filename);
+                }
+            }
+            snprintf(filename, sizeof(filename), "%smaster.m3u8", c->dirname);
+            dashenc_delete_file(s, filename);
+        }
     }
 
     return 0;