[FFmpeg-devel] avformat/hlsenc: add warning message when use fmp4 and byte range mode

Submitted by Steven Liu on July 6, 2017, 2:55 a.m.

Details

Message ID 20170706025513.4386-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu July 6, 2017, 2:55 a.m.
have not support fmp4 byterange mode now, so give a warn message

Suggested-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
---
 libavformat/hlsenc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Derek Buitenhuis July 6, 2017, 3:31 p.m.
On 7/6/2017 3:55 AM, Steven Liu wrote:
> +    if (hls->segment_type == SEGMENT_TYPE_FMP4 && byterange_mode) {
> +        av_log(s, AV_LOG_WARNING, "Have not support fmp4 byterange mode yet now, patch "
> +               "welcome or wait to support it, change the hls_segment_type to mpegts now.\n");
> +        hls->segment_type = SEGMENT_TYPE_MPEGTS;
> +    }

It should hard-fail, and definitely not just continue on with MPEG-TS segments. That's
really unexpected behavior for a user.

It should return AVERROR_PATCHWELCOME, probably.

Do you have plans to implement the functionality in the future?

Cheers,
- Derek
Steven Liu July 6, 2017, 10:30 p.m.
2017-07-06 23:31 GMT+08:00 Derek Buitenhuis <derek.buitenhuis@gmail.com>:
> On 7/6/2017 3:55 AM, Steven Liu wrote:
>> +    if (hls->segment_type == SEGMENT_TYPE_FMP4 && byterange_mode) {
>> +        av_log(s, AV_LOG_WARNING, "Have not support fmp4 byterange mode yet now, patch "
>> +               "welcome or wait to support it, change the hls_segment_type to mpegts now.\n");
>> +        hls->segment_type = SEGMENT_TYPE_MPEGTS;
>> +    }
>
> It should hard-fail, and definitely not just continue on with MPEG-TS segments. That's
> really unexpected behavior for a user.
>
> It should return AVERROR_PATCHWELCOME, probably.
ok, merge it.
>
> Do you have plans to implement the functionality in the future?
Yes, but these days i'm busy, will fix it later.
>
> Cheers,
> - Derek
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Steven Liu July 7, 2017, 2:06 a.m.
2017-07-07 6:30 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>:
> 2017-07-06 23:31 GMT+08:00 Derek Buitenhuis <derek.buitenhuis@gmail.com>:
>> On 7/6/2017 3:55 AM, Steven Liu wrote:
>>> +    if (hls->segment_type == SEGMENT_TYPE_FMP4 && byterange_mode) {
>>> +        av_log(s, AV_LOG_WARNING, "Have not support fmp4 byterange mode yet now, patch "
>>> +               "welcome or wait to support it, change the hls_segment_type to mpegts now.\n");
>>> +        hls->segment_type = SEGMENT_TYPE_MPEGTS;
>>> +    }
>>
>> It should hard-fail, and definitely not just continue on with MPEG-TS segments. That's
>> really unexpected behavior for a user.
>>
>> It should return AVERROR_PATCHWELCOME, probably.
> ok, merge it.
>>
>> Do you have plans to implement the functionality in the future?
> Yes, but these days i'm busy, will fix it later.
>>
>> Cheers,
>> - Derek
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

pushed with Derek Buitenhuis suggest.

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index dd6a62b..f1157a9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1304,9 +1304,15 @@  static int hls_write_header(AVFormatContext *s)
     const char *pattern_localtime_fmt = get_default_pattern_localtime_fmt();
     const char *vtt_pattern = "%d.vtt";
     AVDictionary *options = NULL;
+    int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
     int basename_size;
     int vtt_basename_size;
 
+    if (hls->segment_type == SEGMENT_TYPE_FMP4 && byterange_mode) {
+        av_log(s, AV_LOG_WARNING, "Have not support fmp4 byterange mode yet now, patch "
+               "welcome or wait to support it, change the hls_segment_type to mpegts now.\n");
+        hls->segment_type = SEGMENT_TYPE_MPEGTS;
+    }
     if ((hls->start_sequence_source_type == HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH) ||
         (hls->start_sequence_source_type == HLS_START_SEQUENCE_AS_FORMATTED_DATETIME)) {
         time_t t = time(NULL); // we will need it in either case