diff options
author | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-16 06:07:44 +0000 |
---|---|---|
committer | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-16 06:07:44 +0000 |
commit | f1e59edef784dc1516e4699d2be2125ce0159904 (patch) | |
tree | 47a57bda6f927c332ee9e0da500b90a5125f16da /media/base/pipeline_unittest.cc | |
parent | 0e6c1615e51ba91534549f65a3c5663600b792cc (diff) | |
download | chromium_src-f1e59edef784dc1516e4699d2be2125ce0159904.zip chromium_src-f1e59edef784dc1516e4699d2be2125ce0159904.tar.gz chromium_src-f1e59edef784dc1516e4699d2be2125ce0159904.tar.bz2 |
Revert of Fix seeking when the start time is non-zero. (https://codereview.chromium.org/325503003/)
Reason for revert:
Broke the following layout tests:
- media/track/track-cue-rendering-horizontal.html
- media/track/track-cue-rendering-vertical.html
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=%40ToT%20Blink&tests=media/track/track-cue-rendering-horizontal.html,media/track/track-cue-rendering-vertical.html
Original issue's description:
> Fix seeking when the start time is non-zero.
>
> The seek timestamp should always be adjusted by the start time,
> though this manipulation should not be visible to external (web)
> clients.
>
> Since this is an FFmpeg only problem, I've removed the concept
> of start time from the Demuxer interface in favor of local method
> only for FFmpegDemuxer. FFmpegDemuxerStream's will now use this
> value to adjust timestamps such that external clients always see
> a zero based timeline.
>
> Doing so required moving some of our ogg vorbis discard code into
> the FFmpegDemuxerStream, which actually makes it more accurate and
> more narrowly scoped to ogg w/ vorbis instead of all vorbis.
>
> These changes subtly change how we handle seeking. Previously we
> would let FFmpeg choose the stream to perform seeking within. Now
> we always use the stream with the lowest order timestamp. This
> means we will sometime use the audio stream where previously we
> used the video stream.
>
> I've extended the tests around non-zero start times to verify the
> new behavior.
>
> An FFmpeg DEPS roll is required for the new tests to pass:
> 9c12290 Revert "avformat/mp3dec: fix start time in light of initial skip samples"
> 1e661a6 avcodec/vorbisdec: Reset first_frame
> 7d88be4 avformat/oggparsevorbis: Dont attempt to calculate timestamps from gp=0
>
> BUG=377295
> TEST=new unittests. demo page from bug works.
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=277348
TBR=acolwell@chromium.org,dalecurtis@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=377295
Review URL: https://codereview.chromium.org/334163002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/pipeline_unittest.cc')
-rw-r--r-- | media/base/pipeline_unittest.cc | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc index 05ffc8c..45cc73ba3 100644 --- a/media/base/pipeline_unittest.cc +++ b/media/base/pipeline_unittest.cc @@ -107,6 +107,9 @@ class PipelineTest : public ::testing::Test { EXPECT_CALL(*demuxer_, GetStream(_)) .WillRepeatedly(Return(null_pointer)); + EXPECT_CALL(*demuxer_, GetStartTime()) + .WillRepeatedly(Return(base::TimeDelta())); + EXPECT_CALL(*demuxer_, GetTimelineOffset()) .WillRepeatedly(Return(base::Time())); @@ -171,7 +174,7 @@ class PipelineTest : public ::testing::Test { EXPECT_CALL(*video_renderer_, SetPlaybackRate(0.0f)); // Startup sequence. - EXPECT_CALL(*video_renderer_, Preroll(base::TimeDelta(), _)) + EXPECT_CALL(*video_renderer_, Preroll(demuxer_->GetStartTime(), _)) .WillOnce(RunCallback<1>(PIPELINE_OK)); EXPECT_CALL(*video_renderer_, Play(_)) .WillOnce(RunClosure<0>()); @@ -736,6 +739,43 @@ TEST_F(PipelineTest, NoMessageDuringTearDownFromError) { message_loop_.RunUntilIdle(); } +TEST_F(PipelineTest, StartTimeIsZero) { + CreateVideoStream(); + MockDemuxerStreamVector streams; + streams.push_back(video_stream()); + + const base::TimeDelta kDuration = base::TimeDelta::FromSeconds(100); + InitializeDemuxer(&streams, kDuration); + InitializeVideoRenderer(video_stream()); + + InitializePipeline(PIPELINE_OK); + EXPECT_FALSE(metadata_.has_audio); + EXPECT_TRUE(metadata_.has_video); + + EXPECT_EQ(base::TimeDelta(), pipeline_->GetMediaTime()); +} + +TEST_F(PipelineTest, StartTimeIsNonZero) { + const base::TimeDelta kStartTime = base::TimeDelta::FromSeconds(4); + const base::TimeDelta kDuration = base::TimeDelta::FromSeconds(100); + + EXPECT_CALL(*demuxer_, GetStartTime()) + .WillRepeatedly(Return(kStartTime)); + + CreateVideoStream(); + MockDemuxerStreamVector streams; + streams.push_back(video_stream()); + + InitializeDemuxer(&streams, kDuration); + InitializeVideoRenderer(video_stream()); + + InitializePipeline(PIPELINE_OK); + EXPECT_FALSE(metadata_.has_audio); + EXPECT_TRUE(metadata_.has_video); + + EXPECT_EQ(kStartTime, pipeline_->GetMediaTime()); +} + static void RunTimeCB(const AudioRenderer::TimeCB& time_cb, int time_in_ms, int max_time_in_ms) { |