From a6352d4b11e13d7aef36f9cc3436d10e1d432e06 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 --- .../testdata/bear-320x240-opus-vp9-cenc-golden.mpd | 4 ++-- .../testdata/bear-320x240-vp9-opus-webm-golden.mpd | 4 ++-- .../testdata/bear-640x360-av-cenc-ad_cues-golden.mpd | 4 ++-- .../bear-640x360-av-live-static-ad_cues-golden.mpd | 4 ++-- .../test/testdata/bear-640x360-vp8-cenc-golden.mpd | 2 +- .../testdata/bear-640x360-vp8-cenc-webm-golden.mpd | 2 +- .../test/testdata/bear-640x360-vp8-webm-golden.mpd | 2 +- packager/app/test/testdata/bear-avc3-wvm-golden.mpd | 8 ++++---- packager/app/test/testdata/bear-wvm-golden.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/bear-320x240-opus-vp9-cenc-golden.mpd b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd index 2c08704556..4707fd40e5 100644 --- a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd @@ -10,7 +10,7 @@ output_audio.mp4 - + @@ -22,7 +22,7 @@ output_video.mp4 - + diff --git a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd index 6dc1619cad..1cd3e28959 100644 --- a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd @@ -6,7 +6,7 @@ output_audio.webm - + @@ -14,7 +14,7 @@ output_video.webm - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd index 088ce48969..7c23367ae0 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd @@ -37,7 +37,7 @@ output_audio.mp4 - + @@ -49,7 +49,7 @@ output_video.mp4 - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd index 55f6ce4224..72f56ed30c 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd @@ -28,7 +28,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd index aa01398514..8ab532cc3f 100644 --- a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd @@ -9,7 +9,7 @@ output_video.mp4 - + diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd index 0b3ec13441..bb128a1750 100644 --- a/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd @@ -8,7 +8,7 @@ output_video.webm - + diff --git a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd index 555d6c283c..e2c780127b 100644 --- a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd @@ -5,7 +5,7 @@ output_video.webm - + diff --git a/packager/app/test/testdata/bear-avc3-wvm-golden.mpd b/packager/app/test/testdata/bear-avc3-wvm-golden.mpd index 66b6b9bf71..151c893bac 100644 --- a/packager/app/test/testdata/bear-avc3-wvm-golden.mpd +++ b/packager/app/test/testdata/bear-avc3-wvm-golden.mpd @@ -5,13 +5,13 @@ output_0.mp4 - + output_2.mp4 - + @@ -20,14 +20,14 @@ output_1.mp4 - + output_3.mp4 - + diff --git a/packager/app/test/testdata/bear-wvm-golden.mpd b/packager/app/test/testdata/bear-wvm-golden.mpd index 7abea46a19..65a206653e 100644 --- a/packager/app/test/testdata/bear-wvm-golden.mpd +++ b/packager/app/test/testdata/bear-wvm-golden.mpd @@ -5,13 +5,13 @@ output_0.mp4 - + output_2.mp4 - + @@ -20,14 +20,14 @@ output_1.mp4 - + output_3.mp4 - + diff --git a/packager/mpd/base/mpd_builder_unittest.cc b/packager/mpd/base/mpd_builder_unittest.cc index 49fb4fc72d..1600333148 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 08ad897f8d..49a63a7592 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 045067cf6f..8210e39095 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 { @@ -523,8 +520,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; @@ -537,8 +532,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',