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
This commit is contained in:
KongQun Yang 2018-04-09 11:47:29 -07:00
parent 9716ef73a0
commit a6352d4b11
13 changed files with 20 additions and 48 deletions

View File

@ -10,7 +10,7 @@
<Representation id="0" bandwidth="81568" codecs="opus" mimeType="audio/mp4" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_audio.mp4</BaseURL>
<SegmentBase indexRange="975-1042" timescale="1000000" presentationTimeOffset="36999">
<SegmentBase indexRange="975-1042" timescale="1000000" presentationTimeOffset="37000">
<Initialization range="0-974"/>
</SegmentBase>
</Representation>
@ -22,7 +22,7 @@
</ContentProtection>
<Representation id="1" bandwidth="210205" codecs="vp09.00.10.08.01.02.02.02.00" mimeType="video/mp4" sar="427:320">
<BaseURL>output_video.mp4</BaseURL>
<SegmentBase indexRange="1063-1130" timescale="1000000" presentationTimeOffset="36999">
<SegmentBase indexRange="1063-1130" timescale="1000000" presentationTimeOffset="37000">
<Initialization range="0-1062"/>
</SegmentBase>
</Representation>

View File

@ -6,7 +6,7 @@
<Representation id="0" bandwidth="76531" codecs="opus" mimeType="audio/webm" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_audio.webm</BaseURL>
<SegmentBase indexRange="323-371" timescale="1000000" presentationTimeOffset="36999">
<SegmentBase indexRange="323-371" timescale="1000000" presentationTimeOffset="37000">
<Initialization range="0-322"/>
</SegmentBase>
</Representation>
@ -14,7 +14,7 @@
<AdaptationSet id="1" contentType="video" width="320" height="240" frameRate="1000000/34000" subsegmentAlignment="true" par="16:9">
<Representation id="1" bandwidth="203360" codecs="vp9" mimeType="video/webm" sar="427:320">
<BaseURL>output_video.webm</BaseURL>
<SegmentBase indexRange="302-350" timescale="1000000" presentationTimeOffset="36999">
<SegmentBase indexRange="302-350" timescale="1000000" presentationTimeOffset="37000">
<Initialization range="0-301"/>
</SegmentBase>
</Representation>

View File

@ -37,7 +37,7 @@
<Representation id="0" bandwidth="129651" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_audio.mp4</BaseURL>
<SegmentBase indexRange="967-1046" timescale="44100" presentationTimeOffset="91230">
<SegmentBase indexRange="967-1046" timescale="44100" presentationTimeOffset="91231">
<Initialization range="0-966"/>
</SegmentBase>
</Representation>
@ -49,7 +49,7 @@
</ContentProtection>
<Representation id="1" bandwidth="885590" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
<BaseURL>output_video.mp4</BaseURL>
<SegmentBase indexRange="1091-1158" timescale="30000" presentationTimeOffset="62061">
<SegmentBase indexRange="1091-1158" timescale="30000" presentationTimeOffset="62062">
<Initialization range="0-1090"/>
</SegmentBase>
</Representation>

View File

@ -28,7 +28,7 @@
<Period id="1" duration="PT.7340666666666666S">
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="30000/1001" segmentAlignment="true" par="16:9">
<Representation id="0" bandwidth="869044" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
<SegmentTemplate timescale="30000" presentationTimeOffset="62061" initialization="output_video-init.mp4" media="output_video-$Number$.m4s" startNumber="3">
<SegmentTemplate timescale="30000" presentationTimeOffset="62062" initialization="output_video-init.mp4" media="output_video-$Number$.m4s" startNumber="3">
<SegmentTimeline>
<S t="62062" d="22022"/>
</SegmentTimeline>
@ -38,7 +38,7 @@
<AdaptationSet id="1" contentType="audio" segmentAlignment="true">
<Representation id="1" bandwidth="105634" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<SegmentTemplate timescale="44100" presentationTimeOffset="91230" initialization="output_audio-init.mp4" media="output_audio-$Number$.m4s" startNumber="4">
<SegmentTemplate timescale="44100" presentationTimeOffset="91231" initialization="output_audio-init.mp4" media="output_audio-$Number$.m4s" startNumber="4">
<SegmentTimeline>
<S t="91136" d="30720"/>
</SegmentTimeline>

View File

@ -9,7 +9,7 @@
</ContentProtection>
<Representation id="0" bandwidth="341018" codecs="vp08.00.10.08.01.02.02.02.00" mimeType="video/mp4" sar="1:1">
<BaseURL>output_video.mp4</BaseURL>
<SegmentBase indexRange="1031-1098" timescale="1000000" presentationTimeOffset="25999">
<SegmentBase indexRange="1031-1098" timescale="1000000" presentationTimeOffset="26000">
<Initialization range="0-1030"/>
</SegmentBase>
</Representation>

View File

@ -8,7 +8,7 @@
</ContentProtection>
<Representation id="0" bandwidth="337062" codecs="vp8" mimeType="video/webm" sar="1:1">
<BaseURL>output_video.webm</BaseURL>
<SegmentBase indexRange="340-389" timescale="1000000" presentationTimeOffset="25999">
<SegmentBase indexRange="340-389" timescale="1000000" presentationTimeOffset="26000">
<Initialization range="0-339"/>
</SegmentBase>
</Representation>

View File

@ -5,7 +5,7 @@
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="1000000/33000" subsegmentAlignment="true" par="16:9">
<Representation id="0" bandwidth="335457" codecs="vp8" mimeType="video/webm" sar="1:1">
<BaseURL>output_video.webm</BaseURL>
<SegmentBase indexRange="289-338" timescale="1000000" presentationTimeOffset="25999">
<SegmentBase indexRange="289-338" timescale="1000000" presentationTimeOffset="26000">
<Initialization range="0-288"/>
</SegmentBase>
</Representation>

View File

@ -5,13 +5,13 @@
<AdaptationSet id="0" contentType="video" maxWidth="640" maxHeight="360" frameRate="90000/3003" subsegmentAlignment="true" par="16:9">
<Representation id="0" bandwidth="354240" codecs="avc3.64000d" mimeType="video/mp4" sar="1:1" width="320" height="180">
<BaseURL>output_0.mp4</BaseURL>
<SegmentBase indexRange="818-885" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="818-885" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-817"/>
</SegmentBase>
</Representation>
<Representation id="2" bandwidth="888442" codecs="avc3.64001e" mimeType="video/mp4" sar="1:1" width="640" height="360">
<BaseURL>output_2.mp4</BaseURL>
<SegmentBase indexRange="819-886" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="819-886" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-818"/>
</SegmentBase>
</Representation>
@ -20,14 +20,14 @@
<Representation id="1" bandwidth="132362" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_1.mp4</BaseURL>
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-756"/>
</SegmentBase>
</Representation>
<Representation id="3" bandwidth="136806" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_3.mp4</BaseURL>
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-756"/>
</SegmentBase>
</Representation>

View File

@ -5,13 +5,13 @@
<AdaptationSet id="0" contentType="video" maxWidth="640" maxHeight="360" frameRate="90000/3003" subsegmentAlignment="true" par="16:9">
<Representation id="0" bandwidth="353919" codecs="avc1.64000d" mimeType="video/mp4" sar="1:1" width="320" height="180">
<BaseURL>output_0.mp4</BaseURL>
<SegmentBase indexRange="822-889" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="822-889" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-821"/>
</SegmentBase>
</Representation>
<Representation id="2" bandwidth="888108" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1" width="640" height="360">
<BaseURL>output_2.mp4</BaseURL>
<SegmentBase indexRange="823-890" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="823-890" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-822"/>
</SegmentBase>
</Representation>
@ -20,14 +20,14 @@
<Representation id="1" bandwidth="132362" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_1.mp4</BaseURL>
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-756"/>
</SegmentBase>
</Representation>
<Representation id="3" bandwidth="136806" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_3.mp4</BaseURL>
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="17999">
<SegmentBase indexRange="757-824" timescale="90000" presentationTimeOffset="18000">
<Initialization range="0-756"/>
</SegmentBase>
</Representation>

View File

@ -4,7 +4,6 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include <gflags/gflags.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@ -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;

View File

@ -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);
}

View File

@ -6,7 +6,6 @@
#include "packager/mpd/base/representation.h"
#include <gflags/gflags.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <inttypes.h>
@ -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) {
"<Representation id=\"1\" bandwidth=\"102400\" "
" codecs=\"avc1.010101\" mimeType=\"video/mp4\" sar=\"1:1\" "
" width=\"720\" height=\"480\" frameRate=\"10/5\">\n"
// pto = kPresentationTimeOffsetSeconds * timescale + FLAGS_pto_adjustment
" <SegmentTemplate timescale=\"1000\" presentationTimeOffset=\"2299\""
" <SegmentTemplate timescale=\"1000\" presentationTimeOffset=\"2300\""
" initialization=\"init.mp4\" media=\"$Time$.mp4\">\n"
" <SegmentTimeline>\n"
" <S t=\"0\" d=\"10\"/>\n"

View File

@ -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',