From 4f14a6f9739cca7b755d1dcaf5c93fb3e358f5a8 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 7 Oct 2019 22:43:10 -0700 Subject: [PATCH] [HLS] Always set FRAME-RATE attribute Although FRAME-RATE is optional per HLS specification, but per HLS Authoring Specification for Apple Devices (https://apple.co/30n90DC): Each EXT-X-STREAM-INF tag MUST have a FRAME-RATE attribute. Also, iOS and TVos refuse to play the content if VIDEO-RANGE is present but FRAME-RATE is missing. Issue #632, #634. Change-Id: Ica282f023a7e8538f7b506094e2286840cf5c193 --- .../output.m3u8 | 4 ++-- .../audio-video-with-language-override/output.m3u8 | 4 ++-- packager/app/test/testdata/av1-mp4-to-webm/output.m3u8 | 2 +- .../test/testdata/av1-mp4-with-encryption/output.m3u8 | 2 +- packager/app/test/testdata/av1-mp4/output.m3u8 | 2 +- .../test/testdata/av1-webm-with-encryption/output.m3u8 | 2 +- packager/app/test/testdata/av1-webm/output.m3u8 | 2 +- packager/app/test/testdata/avc-ac3-ts-to-mp4/output.m3u8 | 4 ++-- .../app/test/testdata/bandwidth-override/output.m3u8 | 4 ++-- .../app/test/testdata/dvh1-with-encryption/output.m3u8 | 2 +- .../ec3-and-hls-single-segment-mp4-encrypted/output.m3u8 | 4 ++-- .../encryption-and-ad-cues-split-content/output.m3u8 | 4 ++-- .../app/test/testdata/encryption-and-ad-cues/output.m3u8 | 4 ++-- .../test/testdata/encryption-with-multi-drms/output.m3u8 | 2 +- .../app/test/testdata/hdr10-with-encryption/output.m3u8 | 2 +- .../hls-audio-video-text-with-ad-cues/output.m3u8 | 4 ++-- .../hls-multi-segment-mp4-with-custom-path/output.m3u8 | 2 +- .../hls-single-segment-mp4-encrypted/output.m3u8 | 4 ++-- .../app/test/testdata/live-profile-with-webm/output.m3u8 | 2 +- .../testdata/vtt-text-to-mp4-with-ad-cues/output.m3u8 | 4 ++-- packager/hls/base/master_playlist.cc | 9 ++++----- 21 files changed, 34 insertions(+), 35 deletions(-) diff --git a/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.m3u8 b/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.m3u8 index bdb0aefddb..43e1ae059e 100644 --- a/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.m3u8 +++ b/packager/app/test/testdata/audio-video-with-language-override-with-subtag/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-audio.m3u8",GROUP-ID="default-audio-group",LANGUAGE="pt-BR",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1106817,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1106817,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/audio-video-with-language-override/output.m3u8 b/packager/app/test/testdata/audio-video-with-language-override/output.m3u8 index 3954bb5791..08cf651186 100644 --- a/packager/app/test/testdata/audio-video-with-language-override/output.m3u8 +++ b/packager/app/test/testdata/audio-video-with-language-override/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-audio.m3u8",GROUP-ID="default-audio-group",LANGUAGE="pt",NAME="stream_0",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1106817,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1106817,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/av1-mp4-to-webm/output.m3u8 b/packager/app/test/testdata/av1-mp4-to-webm/output.m3u8 index 285a3b19e7..75cea099f4 100644 --- a/packager/app/test/testdata/av1-mp4-to-webm/output.m3u8 +++ b/packager/app/test/testdata/av1-mp4-to-webm/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=69160,AVERAGE-BANDWIDTH=69160,CODECS="av01.0.00M.08",RESOLUTION=320x240 +#EXT-X-STREAM-INF:BANDWIDTH=69160,AVERAGE-BANDWIDTH=69160,CODECS="av01.0.00M.08",RESOLUTION=320x240,FRAME-RATE=29.970 stream_0.m3u8 diff --git a/packager/app/test/testdata/av1-mp4-with-encryption/output.m3u8 b/packager/app/test/testdata/av1-mp4-with-encryption/output.m3u8 index f47182b80a..cbcc012795 100644 --- a/packager/app/test/testdata/av1-mp4-with-encryption/output.m3u8 +++ b/packager/app/test/testdata/av1-mp4-with-encryption/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08",RESOLUTION=320x240 +#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08",RESOLUTION=320x240,FRAME-RATE=29.970 stream_0.m3u8 diff --git a/packager/app/test/testdata/av1-mp4/output.m3u8 b/packager/app/test/testdata/av1-mp4/output.m3u8 index f47182b80a..cbcc012795 100644 --- a/packager/app/test/testdata/av1-mp4/output.m3u8 +++ b/packager/app/test/testdata/av1-mp4/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08",RESOLUTION=320x240 +#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08",RESOLUTION=320x240,FRAME-RATE=29.970 stream_0.m3u8 diff --git a/packager/app/test/testdata/av1-webm-with-encryption/output.m3u8 b/packager/app/test/testdata/av1-webm-with-encryption/output.m3u8 index 72f2d46353..6c7884e549 100644 --- a/packager/app/test/testdata/av1-webm-with-encryption/output.m3u8 +++ b/packager/app/test/testdata/av1-webm-with-encryption/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=69426,AVERAGE-BANDWIDTH=69426,CODECS="av01.0.00M.08",RESOLUTION=320x240 +#EXT-X-STREAM-INF:BANDWIDTH=69426,AVERAGE-BANDWIDTH=69426,CODECS="av01.0.00M.08",RESOLUTION=320x240,FRAME-RATE=30.303 stream_0.m3u8 diff --git a/packager/app/test/testdata/av1-webm/output.m3u8 b/packager/app/test/testdata/av1-webm/output.m3u8 index a746aaa65c..32a6032b0f 100644 --- a/packager/app/test/testdata/av1-webm/output.m3u8 +++ b/packager/app/test/testdata/av1-webm/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=70752,AVERAGE-BANDWIDTH=70752,CODECS="av01.0.00M.08",RESOLUTION=320x240 +#EXT-X-STREAM-INF:BANDWIDTH=70752,AVERAGE-BANDWIDTH=70752,CODECS="av01.0.00M.08",RESOLUTION=320x240,FRAME-RATE=30.303 stream_0.m3u8 diff --git a/packager/app/test/testdata/avc-ac3-ts-to-mp4/output.m3u8 b/packager/app/test/testdata/avc-ac3-ts-to-mp4/output.m3u8 index 5460b26ebf..3de1fe07e8 100644 --- a/packager/app/test/testdata/avc-ac3-ts-to-mp4/output.m3u8 +++ b/packager/app/test/testdata/avc-ac3-ts-to-mp4/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-ac3-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1168321,AVERAGE-BANDWIDTH=1074156,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1168321,AVERAGE-BANDWIDTH=1074156,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-ac3-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-ac3-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-ac3-video-iframe.m3u8" diff --git a/packager/app/test/testdata/bandwidth-override/output.m3u8 b/packager/app/test/testdata/bandwidth-override/output.m3u8 index e9de42ef3f..e968583c7a 100644 --- a/packager/app/test/testdata/bandwidth-override/output.m3u8 +++ b/packager/app/test/testdata/bandwidth-override/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=55555,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=55555,AVERAGE-BANDWIDTH=1004632,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=44444,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=44444,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/dvh1-with-encryption/output.m3u8 b/packager/app/test/testdata/dvh1-with-encryption/output.m3u8 index 059f1dad96..c7db8f443c 100644 --- a/packager/app/test/testdata/dvh1-with-encryption/output.m3u8 +++ b/packager/app/test/testdata/dvh1-with-encryption/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=375371,AVERAGE-BANDWIDTH=368196,CODECS="dvh1.05.01",RESOLUTION=426x240,VIDEO-RANGE=PQ +#EXT-X-STREAM-INF:BANDWIDTH=375371,AVERAGE-BANDWIDTH=368196,CODECS="dvh1.05.01",RESOLUTION=426x240,FRAME-RATE=23.810,VIDEO-RANGE=PQ stream_0.m3u8 diff --git a/packager/app/test/testdata/ec3-and-hls-single-segment-mp4-encrypted/output.m3u8 b/packager/app/test/testdata/ec3-and-hls-single-segment-mp4-encrypted/output.m3u8 index 4df168191d..5b7a1666be 100644 --- a/packager/app/test/testdata/ec3-and-hls-single-segment-mp4-encrypted/output.m3u8 +++ b/packager/app/test/testdata/ec3-and-hls-single-segment-mp4-encrypted/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-ec3-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1174214,AVERAGE-BANDWIDTH=1061802,CODECS="avc1.64001e,ec-3",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1174214,AVERAGE-BANDWIDTH=1061802,CODECS="avc1.64001e,ec-3",RESOLUTION=640x360,FRAME-RATE=9.990,AUDIO="default-audio-group" bear-640x360-ec3-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159315,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-ec3-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159315,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=9.990,URI="bear-640x360-ec3-video-iframe.m3u8" diff --git a/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.m3u8 b/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.m3u8 index 9bf414f3f9..b78bdf94b8 100644 --- a/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.m3u8 +++ b/packager/app/test/testdata/encryption-and-ad-cues-split-content/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1111200,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1111200,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/encryption-and-ad-cues/output.m3u8 b/packager/app/test/testdata/encryption-and-ad-cues/output.m3u8 index 9bf414f3f9..b78bdf94b8 100644 --- a/packager/app/test/testdata/encryption-and-ad-cues/output.m3u8 +++ b/packager/app/test/testdata/encryption-and-ad-cues/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1111200,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1111200,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/encryption-with-multi-drms/output.m3u8 b/packager/app/test/testdata/encryption-with-multi-drms/output.m3u8 index b01af091c9..ef6c35c353 100644 --- a/packager/app/test/testdata/encryption-with-multi-drms/output.m3u8 +++ b/packager/app/test/testdata/encryption-with-multi-drms/output.m3u8 @@ -3,5 +3,5 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="stream_0.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1111406,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1111406,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" stream_1.m3u8 diff --git a/packager/app/test/testdata/hdr10-with-encryption/output.m3u8 b/packager/app/test/testdata/hdr10-with-encryption/output.m3u8 index 172e574684..a4217de48e 100644 --- a/packager/app/test/testdata/hdr10-with-encryption/output.m3u8 +++ b/packager/app/test/testdata/hdr10-with-encryption/output.m3u8 @@ -1,5 +1,5 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=317223,AVERAGE-BANDWIDTH=317223,CODECS="hvc1.2.4.L63.90",RESOLUTION=640x360,VIDEO-RANGE=PQ +#EXT-X-STREAM-INF:BANDWIDTH=317223,AVERAGE-BANDWIDTH=317223,CODECS="hvc1.2.4.L63.90",RESOLUTION=640x360,FRAME-RATE=29.970,VIDEO-RANGE=PQ stream_0.m3u8 diff --git a/packager/app/test/testdata/hls-audio-video-text-with-ad-cues/output.m3u8 b/packager/app/test/testdata/hls-audio-video-text-with-ad-cues/output.m3u8 index d4964ec2c5..ecf71733bc 100644 --- a/packager/app/test/testdata/hls-audio-video-text-with-ad-cues/output.m3u8 +++ b/packager/app/test/testdata/hls-audio-video-text-with-ad-cues/output.m3u8 @@ -5,7 +5,7 @@ #EXT-X-MEDIA:TYPE=SUBTITLES,URI="bear-english-text.m3u8",GROUP-ID="default-text-group",NAME="stream_0",AUTOSELECT=YES -#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group",SUBTITLES="default-text-group" +#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group",SUBTITLES="default-text-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/hls-multi-segment-mp4-with-custom-path/output.m3u8 b/packager/app/test/testdata/hls-multi-segment-mp4-with-custom-path/output.m3u8 index 982739adbb..71588c770b 100644 --- a/packager/app/test/testdata/hls-multi-segment-mp4-with-custom-path/output.m3u8 +++ b/packager/app/test/testdata/hls-multi-segment-mp4-with-custom-path/output.m3u8 @@ -3,5 +3,5 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="audio/audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" video/video.m3u8 diff --git a/packager/app/test/testdata/hls-single-segment-mp4-encrypted/output.m3u8 b/packager/app/test/testdata/hls-single-segment-mp4-encrypted/output.m3u8 index 6d8aee36e8..f34feeb7a2 100644 --- a/packager/app/test/testdata/hls-single-segment-mp4-encrypted/output.m3u8 +++ b/packager/app/test/testdata/hls-single-segment-mp4-encrypted/output.m3u8 @@ -3,7 +3,7 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=1111406,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=1111406,AVERAGE-BANDWIDTH=1009412,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/app/test/testdata/live-profile-with-webm/output.m3u8 b/packager/app/test/testdata/live-profile-with-webm/output.m3u8 index 670f5e9744..1c32890e7a 100644 --- a/packager/app/test/testdata/live-profile-with-webm/output.m3u8 +++ b/packager/app/test/testdata/live-profile-with-webm/output.m3u8 @@ -3,5 +3,5 @@ #EXT-X-MEDIA:TYPE=AUDIO,URI="stream_0.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2" -#EXT-X-STREAM-INF:BANDWIDTH=556353,AVERAGE-BANDWIDTH=412719,CODECS="vp08.00.10.08.01.02.02.02.00,vorbis",RESOLUTION=640x360,AUDIO="default-audio-group" +#EXT-X-STREAM-INF:BANDWIDTH=556353,AVERAGE-BANDWIDTH=412719,CODECS="vp08.00.10.08.01.02.02.02.00,vorbis",RESOLUTION=640x360,FRAME-RATE=30.303,AUDIO="default-audio-group" stream_1.m3u8 diff --git a/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.m3u8 b/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.m3u8 index d4964ec2c5..ecf71733bc 100644 --- a/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.m3u8 +++ b/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.m3u8 @@ -5,7 +5,7 @@ #EXT-X-MEDIA:TYPE=SUBTITLES,URI="bear-english-text.m3u8",GROUP-ID="default-text-group",NAME="stream_0",AUTOSELECT=YES -#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,AUDIO="default-audio-group",SUBTITLES="default-text-group" +#EXT-X-STREAM-INF:BANDWIDTH=1108051,AVERAGE-BANDWIDTH=1005999,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group",SUBTITLES="default-text-group" bear-640x360-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/hls/base/master_playlist.cc b/packager/hls/base/master_playlist.cc index ea64e96d96..f0abf23390 100644 --- a/packager/hls/base/master_playlist.cc +++ b/packager/hls/base/master_playlist.cc @@ -222,12 +222,11 @@ void BuildStreamInfTag(const MediaPlaylist& playlist, uint32_t height; if (playlist.GetDisplayResolution(&width, &height)) { tag.AddNumberPair("RESOLUTION", width, 'x', height); - // Per HLS specification, The FRAME-RATE attribute SHOULD be included if any - // video in a Variant Stream exceeds 30 frames per second. - // Right now the frame-rate returned may not be accurate in some scenario. - // TODO(kqyang): Set frame-rate unconditionally once it is fixed. + + // Right now the frame-rate returned may not be accurate in some scenarios. + // TODO(kqyang): Fix frame-rate computation. const double frame_rate = playlist.GetFrameRate(); - if (frame_rate >= 30.5) + if (frame_rate > 0) tag.AddFloat("FRAME-RATE", frame_rate); const std::string video_range = playlist.GetVideoRange();