From 4549b1d569048ca1051a9b53423d9f1fccb7d250 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 9 Apr 2018 11:47:29 -0700 Subject: [PATCH] Remove pto_adjustment flag This flag was introduced to workaround a rounding error in Chrome (probably in other browsers too). Also although this flag avoids the first frame of a Period to be dropped due to rounding error but it could cause the last frame of a Period to be dropped. Now that we use a high precision Period@duration, we do not expect to see rounding errors any more. The player would be a better place for the workaround even if it is still needed. Related issue: #368. Change-Id: I3bd517ecc6d548ff62e0c13394edb49d4bc68e8f --- .../test/testdata/encryption-and-ad-cues/output.mpd | 4 ++-- .../live-static-profile-and-ad-cues/output.mpd | 4 ++-- .../testdata/opus-vp9-mp4-with-encryption/output.mpd | 4 ++-- .../test/testdata/vp8-mp4-with-encryption/output.mpd | 2 +- packager/app/test/testdata/vp8-webm/output.mpd | 2 +- packager/app/test/testdata/vp9-webm/output.mpd | 4 ++-- .../test/testdata/webm-with-encryption/output.mpd | 2 +- .../output.mpd | 8 ++++---- packager/app/test/testdata/wvm-input/output.mpd | 8 ++++---- packager/mpd/base/mpd_builder_unittest.cc | 9 --------- packager/mpd/base/representation.cc | 12 ------------ packager/mpd/base/representation_unittest.cc | 8 +------- packager/mpd/mpd.gyp | 1 - 13 files changed, 20 insertions(+), 48 deletions(-) diff --git a/packager/app/test/testdata/encryption-and-ad-cues/output.mpd b/packager/app/test/testdata/encryption-and-ad-cues/output.mpd index 652fc0c580..501f4288dd 100644 --- a/packager/app/test/testdata/encryption-and-ad-cues/output.mpd +++ b/packager/app/test/testdata/encryption-and-ad-cues/output.mpd @@ -37,7 +37,7 @@ bear-640x360-audio.mp4 - + @@ -49,7 +49,7 @@ bear-640x360-video.mp4 - + diff --git a/packager/app/test/testdata/live-static-profile-and-ad-cues/output.mpd b/packager/app/test/testdata/live-static-profile-and-ad-cues/output.mpd index 6402c84a12..e024ad5333 100644 --- a/packager/app/test/testdata/live-static-profile-and-ad-cues/output.mpd +++ b/packager/app/test/testdata/live-static-profile-and-ad-cues/output.mpd @@ -28,7 +28,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/packager/app/test/testdata/opus-vp9-mp4-with-encryption/output.mpd b/packager/app/test/testdata/opus-vp9-mp4-with-encryption/output.mpd index a593f3f41a..9ba2d9b72d 100644 --- a/packager/app/test/testdata/opus-vp9-mp4-with-encryption/output.mpd +++ b/packager/app/test/testdata/opus-vp9-mp4-with-encryption/output.mpd @@ -10,7 +10,7 @@ bear-320x240-vp9-opus-audio.mp4 - + @@ -22,7 +22,7 @@ bear-320x240-vp9-opus-video.mp4 - + diff --git a/packager/app/test/testdata/vp8-mp4-with-encryption/output.mpd b/packager/app/test/testdata/vp8-mp4-with-encryption/output.mpd index f895dbe352..afbd586a37 100644 --- a/packager/app/test/testdata/vp8-mp4-with-encryption/output.mpd +++ b/packager/app/test/testdata/vp8-mp4-with-encryption/output.mpd @@ -9,7 +9,7 @@ bear-640x360-video.mp4 - + diff --git a/packager/app/test/testdata/vp8-webm/output.mpd b/packager/app/test/testdata/vp8-webm/output.mpd index 665cffa84d..3b0f4feedf 100644 --- a/packager/app/test/testdata/vp8-webm/output.mpd +++ b/packager/app/test/testdata/vp8-webm/output.mpd @@ -5,7 +5,7 @@ bear-640x360-video.webm - + diff --git a/packager/app/test/testdata/vp9-webm/output.mpd b/packager/app/test/testdata/vp9-webm/output.mpd index 2b37025f13..382c854f6e 100644 --- a/packager/app/test/testdata/vp9-webm/output.mpd +++ b/packager/app/test/testdata/vp9-webm/output.mpd @@ -6,7 +6,7 @@ bear-320x240-vp9-opus-audio.webm - + @@ -14,7 +14,7 @@ bear-320x240-vp9-opus-video.webm - + diff --git a/packager/app/test/testdata/webm-with-encryption/output.mpd b/packager/app/test/testdata/webm-with-encryption/output.mpd index a7c3f5b80c..7428611196 100644 --- a/packager/app/test/testdata/webm-with-encryption/output.mpd +++ b/packager/app/test/testdata/webm-with-encryption/output.mpd @@ -8,7 +8,7 @@ bear-640x360-video.webm - + diff --git a/packager/app/test/testdata/wvm-input-without-stripping-parameters-set-nalus/output.mpd b/packager/app/test/testdata/wvm-input-without-stripping-parameters-set-nalus/output.mpd index b21f042c4f..dd290501c0 100644 --- a/packager/app/test/testdata/wvm-input-without-stripping-parameters-set-nalus/output.mpd +++ b/packager/app/test/testdata/wvm-input-without-stripping-parameters-set-nalus/output.mpd @@ -5,13 +5,13 @@ bear-multi-configs-0.mp4 - + bear-multi-configs-2.mp4 - + @@ -20,14 +20,14 @@ bear-multi-configs-1.mp4 - + bear-multi-configs-3.mp4 - + diff --git a/packager/app/test/testdata/wvm-input/output.mpd b/packager/app/test/testdata/wvm-input/output.mpd index c6ee7e7779..2966176422 100644 --- a/packager/app/test/testdata/wvm-input/output.mpd +++ b/packager/app/test/testdata/wvm-input/output.mpd @@ -5,13 +5,13 @@ bear-multi-configs-0.mp4 - + bear-multi-configs-2.mp4 - + @@ -20,14 +20,14 @@ bear-multi-configs-1.mp4 - + bear-multi-configs-3.mp4 - + diff --git a/packager/mpd/base/mpd_builder_unittest.cc b/packager/mpd/base/mpd_builder_unittest.cc index fd2509812b..49fc113aad 100644 --- a/packager/mpd/base/mpd_builder_unittest.cc +++ b/packager/mpd/base/mpd_builder_unittest.cc @@ -4,7 +4,6 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -#include #include #include @@ -15,8 +14,6 @@ #include "packager/mpd/test/mpd_builder_test_helper.h" #include "packager/version/version.h" -DECLARE_int32(pto_adjustment); - using ::testing::HasSubstr; namespace shaka { @@ -175,9 +172,6 @@ TEST_F(OnDemandMpdBuilderTest, MediaInfoMissingBandwidth) { } TEST_F(OnDemandMpdBuilderTest, CheckXmlTest) { - // Disable pto adjustment. - FLAGS_pto_adjustment = 0; - const double kPeriod1StartTimeSeconds = 0.0; // Actual period duration is determined by the segments not by the period @@ -218,9 +212,6 @@ TEST_F(OnDemandMpdBuilderTest, MultiplePeriodTest) { } TEST_F(OnDemandMpdBuilderTest, MultiplePeriodCheckXmlTest) { - // Disable pto adjustment. - FLAGS_pto_adjustment = 0; - const double kPeriod1StartTimeSeconds = 0.0; const double kPeriod2StartTimeSeconds = 3.1; const double kPeriod3StartTimeSeconds = 8.0; diff --git a/packager/mpd/base/representation.cc b/packager/mpd/base/representation.cc index 0cbf3858ca..4bf9861b87 100644 --- a/packager/mpd/base/representation.cc +++ b/packager/mpd/base/representation.cc @@ -13,17 +13,6 @@ #include "packager/mpd/base/mpd_utils.h" #include "packager/mpd/base/xml/xml_node.h" -DEFINE_int32( - pto_adjustment, - -1, - "There could be rounding errors in MSE which could cut the first key frame " - "of the representation and thus cut all the frames until the next key " - "frame, which then leads to a big gap in presentation timeline which " - "stalls playback. A small back off may be necessary to compensate for the " - "possible rounding error. It should not cause any playback issues if it is " - "small enough. The workaround can be removed once the problem is handled " - "in all players."); - namespace shaka { namespace { @@ -315,7 +304,6 @@ void Representation::SetPresentationTimeOffset( uint64_t pto = presentation_time_offset * media_info_.reference_time_scale(); if (pto <= 0) return; - pto += FLAGS_pto_adjustment; media_info_.set_presentation_time_offset(pto); } diff --git a/packager/mpd/base/representation_unittest.cc b/packager/mpd/base/representation_unittest.cc index 92cf52488f..abfa8c79ef 100644 --- a/packager/mpd/base/representation_unittest.cc +++ b/packager/mpd/base/representation_unittest.cc @@ -6,7 +6,6 @@ #include "packager/mpd/base/representation.h" -#include #include #include #include @@ -16,8 +15,6 @@ #include "packager/mpd/test/mpd_builder_test_helper.h" #include "packager/mpd/test/xml_compare.h" -DECLARE_int32(pto_adjustment); - using ::testing::Not; namespace shaka { @@ -524,8 +521,6 @@ TEST_F(SegmentTemplateTest, RepresentationClone) { } TEST_F(SegmentTemplateTest, PresentationTimeOffset) { - FLAGS_pto_adjustment = -1; - const uint64_t kStartTime = 0; const uint64_t kDuration = 10; const uint64_t kSize = 128; @@ -538,8 +533,7 @@ TEST_F(SegmentTemplateTest, PresentationTimeOffset) { "\n" - // pto = kPresentationTimeOffsetSeconds * timescale + FLAGS_pto_adjustment - " \n" " \n" " \n" diff --git a/packager/mpd/mpd.gyp b/packager/mpd/mpd.gyp index a89a195652..10156a3b02 100644 --- a/packager/mpd/mpd.gyp +++ b/packager/mpd/mpd.gyp @@ -104,7 +104,6 @@ '../media/test/media_test.gyp:run_tests_with_atexit_manager', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', - '../third_party/gflags/gflags.gyp:gflags', 'mpd_builder', 'mpd_mocks', 'mpd_util',