From 5c91e54b8be89b023aeb71eadb0c04c08c174ea5 Mon Sep 17 00:00:00 2001 From: koln67 <67125539+koln67@users.noreply.github.com> Date: Fri, 7 Aug 2020 04:51:35 +0000 Subject: [PATCH] [HLS] Don't include FRAME-RATE in EXT-X-STREAM-INF Part of #816. --- .../output.m3u8 | 2 +- .../audio-video-with-language-override/output.m3u8 | 2 +- .../app/test/testdata/avc-ac3-ts-to-mp4/output.m3u8 | 2 +- .../app/test/testdata/bandwidth-override/output.m3u8 | 2 +- .../output.m3u8 | 2 +- .../encryption-and-ad-cues-split-content/output.m3u8 | 2 +- .../test/testdata/encryption-and-ad-cues/output.m3u8 | 2 +- .../hls-audio-video-text-with-ad-cues/output.m3u8 | 2 +- .../hls-single-segment-mp4-encrypted/output.m3u8 | 2 +- .../testdata/vtt-text-to-mp4-with-ad-cues/output.m3u8 | 2 +- packager/hls/base/master_playlist.cc | 10 +++++++--- packager/hls/base/master_playlist_unittest.cc | 1 + 12 files changed, 18 insertions(+), 13 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 43e1ae059e..e9d65fe8da 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 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,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 08cf651186..5b1d8b3b5e 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 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.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 3de1fe07e8..00bd8f5b76 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 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-ac3-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,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 e968583c7a..a8f552a931 100644 --- a/packager/app/test/testdata/bandwidth-override/output.m3u8 +++ b/packager/app/test/testdata/bandwidth-override/output.m3u8 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=44444,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.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 5b7a1666be..1db8a4df84 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 @@ -6,4 +6,4 @@ #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,FRAME-RATE=9.990,URI="bear-640x360-ec3-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159315,CODECS="avc1.64001e",RESOLUTION=640x360,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 b78bdf94b8..d8bb42a8a9 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 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,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 b78bdf94b8..d8bb42a8a9 100644 --- a/packager/app/test/testdata/encryption-and-ad-cues/output.m3u8 +++ b/packager/app/test/testdata/encryption-and-ad-cues/output.m3u8 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.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 ecf71733bc..c42bc7cb6e 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 @@ -8,4 +8,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.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 f34feeb7a2..44e1c1beec 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 @@ -6,4 +6,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=218705,AVERAGE-BANDWIDTH=159070,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.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 ecf71733bc..c42bc7cb6e 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 @@ -8,4 +8,4 @@ #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,FRAME-RATE=29.970,URI="bear-640x360-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=214292,AVERAGE-BANDWIDTH=156327,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-video-iframe.m3u8" diff --git a/packager/hls/base/master_playlist.cc b/packager/hls/base/master_playlist.cc index a3b061a69a..60e3319c3b 100644 --- a/packager/hls/base/master_playlist.cc +++ b/packager/hls/base/master_playlist.cc @@ -225,9 +225,13 @@ void BuildStreamInfTag(const MediaPlaylist& playlist, // 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 > 0) - tag.AddFloat("FRAME-RATE", frame_rate); + const bool is_iframe_playlist = playlist.stream_type() == + MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly; + if (!is_iframe_playlist) { + const double frame_rate = playlist.GetFrameRate(); + if (frame_rate > 0) + tag.AddFloat("FRAME-RATE", frame_rate); + } const std::string video_range = playlist.GetVideoRange(); if (!video_range.empty()) diff --git a/packager/hls/base/master_playlist_unittest.cc b/packager/hls/base/master_playlist_unittest.cc index 9f6f4ab45d..9a2f4f7d9d 100644 --- a/packager/hls/base/master_playlist_unittest.cc +++ b/packager/hls/base/master_playlist_unittest.cc @@ -212,6 +212,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistOneIframePlaylist) { std::unique_ptr mock_playlist = CreateIframePlaylist("media1.m3u8", "avc1", kMaxBitrate, kAvgBitrate); + EXPECT_CALL(*mock_playlist, GetFrameRate()).Times(0); const char kBaseUrl[] = "http://myplaylistdomain.com/"; EXPECT_TRUE(master_playlist_.WriteMasterPlaylist(kBaseUrl, test_output_dir_,