diff mbox

[FFmpeg-devel] avformat/hlsenc: donnot show duplicate segment warning at byterange mode

Message ID 20170616025740.28585-1-lq@chinaffmpeg.org
State Accepted
Commit 3996ae930256f5c387f2d2e46908b7c433efc588
Headers show

Commit Message

Steven Liu June 16, 2017, 2:57 a.m. UTC
When the hlsenc at BYTERANGE mode, it should not show the warning message:
"Duplicated segment filename detected:"

Reported-by: Marco <marco@worldcast.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Steven Liu June 19, 2017, 2:36 a.m. UTC | #1
2017-06-16 10:57 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
> When the hlsenc at BYTERANGE mode, it should not show the warning message:
> "Duplicated segment filename detected:"
>
> Reported-by: Marco <marco@worldcast.com>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 7ed121a..40143c8 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -722,6 +722,7 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
>  {
>      HLSSegment *en = av_malloc(sizeof(*en));
>      const char  *filename;
> +    int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
>      int ret;
>
>      if (!en)
> @@ -737,8 +738,8 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
>      if (hls->use_localtime_mkdir) {
>          filename = hls->avf->filename;
>      }
> -    if (find_segment_by_filename(hls->segments, filename)
> -        || find_segment_by_filename(hls->old_segments, filename)) {
> +    if ((find_segment_by_filename(hls->segments, filename) || find_segment_by_filename(hls->old_segments, filename))
> +        && !byterange_mode) {
>          av_log(hls, AV_LOG_WARNING, "Duplicated segment filename detected: %s\n", filename);
>      }
>      av_strlcpy(en->filename, filename, sizeof(en->filename));
> --
> 1.7.1
>
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Applied!


Thanks
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7ed121a..40143c8 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -722,6 +722,7 @@  static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
 {
     HLSSegment *en = av_malloc(sizeof(*en));
     const char  *filename;
+    int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
     int ret;
 
     if (!en)
@@ -737,8 +738,8 @@  static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
     if (hls->use_localtime_mkdir) {
         filename = hls->avf->filename;
     }
-    if (find_segment_by_filename(hls->segments, filename)
-        || find_segment_by_filename(hls->old_segments, filename)) {
+    if ((find_segment_by_filename(hls->segments, filename) || find_segment_by_filename(hls->old_segments, filename))
+        && !byterange_mode) {
         av_log(hls, AV_LOG_WARNING, "Duplicated segment filename detected: %s\n", filename);
     }
     av_strlcpy(en->filename, filename, sizeof(en->filename));