diff options
author | rileya@chromium.org <rileya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-02 19:56:47 +0000 |
---|---|---|
committer | rileya@chromium.org <rileya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-02 19:56:47 +0000 |
commit | f6c17c1eb6fd3cc3faf9074d2a857c6043c53608 (patch) | |
tree | 0412493c616616173ffe94c6291d0b2ec7e356d0 /media | |
parent | 383cb73369a7cd3eb3bab3cdcb9795938b215b3d (diff) | |
download | chromium_src-f6c17c1eb6fd3cc3faf9074d2a857c6043c53608.zip chromium_src-f6c17c1eb6fd3cc3faf9074d2a857c6043c53608.tar.gz chromium_src-f6c17c1eb6fd3cc3faf9074d2a857c6043c53608.tar.bz2 |
Add clockless video playback perf tests.
BUG=310837
Review URL: https://codereview.chromium.org/86893002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/pipeline_integration_perftest.cc | 65 | ||||
-rw-r--r-- | media/filters/pipeline_integration_test_base.cc | 50 | ||||
-rw-r--r-- | media/filters/pipeline_integration_test_base.h | 12 | ||||
-rw-r--r-- | media/test/data/bear-vp9.webm | bin | 32393 -> 111930 bytes |
4 files changed, 96 insertions, 31 deletions
diff --git a/media/filters/pipeline_integration_perftest.cc b/media/filters/pipeline_integration_perftest.cc index 0d96f30..aea9363 100644 --- a/media/filters/pipeline_integration_perftest.cc +++ b/media/filters/pipeline_integration_perftest.cc @@ -8,40 +8,85 @@ namespace media { -static const int kBenchmarkIterations = 200; +static const int kBenchmarkIterationsAudio = 200; +static const int kBenchmarkIterationsVideo = 20; -static void RunPlaybackBenchmark(const std::string& filename) { +static void RunPlaybackBenchmark(const std::string& filename, + const std::string& name, + int iterations, + bool audio_only) { double time_seconds = 0.0; - for (int i = 0; i < kBenchmarkIterations; ++i) { + for (int i = 0; i < iterations; ++i) { PipelineIntegrationTestBase pipeline; ASSERT_TRUE(pipeline.Start(GetTestDataFilePath(filename), PIPELINE_OK, PipelineIntegrationTestBase::kClockless)); + base::TimeTicks start = base::TimeTicks::HighResNow(); pipeline.Play(); ASSERT_TRUE(pipeline.WaitUntilOnEnded()); // Call Stop() to ensure that the rendering is complete. pipeline.Stop(); - time_seconds += pipeline.GetAudioTime().InSecondsF(); + + if (audio_only) { + time_seconds += pipeline.GetAudioTime().InSecondsF(); + } else { + time_seconds += (base::TimeTicks::HighResNow() - start).InSecondsF(); + } } - perf_test::PrintResult("clockless_playback", + perf_test::PrintResult(name, "", filename, - kBenchmarkIterations / time_seconds, + iterations / time_seconds, "runs/s", true); } +static void RunVideoPlaybackBenchmark(const std::string& filename, + const std::string name) { + RunPlaybackBenchmark(filename, name, kBenchmarkIterationsVideo, false); +} + +static void RunAudioPlaybackBenchmark(const std::string& filename, + const std::string& name) { + RunPlaybackBenchmark(filename, name, kBenchmarkIterationsAudio, true); +} + TEST(PipelineIntegrationPerfTest, AudioPlaybackBenchmark) { - RunPlaybackBenchmark("sfx_f32le.wav"); - RunPlaybackBenchmark("sfx_s24le.wav"); - RunPlaybackBenchmark("sfx_s16le.wav"); - RunPlaybackBenchmark("sfx_u8.wav"); + RunAudioPlaybackBenchmark("sfx_f32le.wav", "clockless_playback"); + RunAudioPlaybackBenchmark("sfx_s24le.wav", "clockless_playback"); + RunAudioPlaybackBenchmark("sfx_s16le.wav", "clockless_playback"); + RunAudioPlaybackBenchmark("sfx_u8.wav", "clockless_playback"); +#if defined(USE_PROPRIETARY_CODECS) + RunAudioPlaybackBenchmark("sfx.mp3", "clockless_playback"); +#endif +} + +TEST(PipelineIntegrationPerfTest, VP8PlaybackBenchmark) { + RunVideoPlaybackBenchmark("bear-640x360.webm", + "clockless_video_playback_vp8"); + RunVideoPlaybackBenchmark("bear-320x240.webm", + "clockless_video_playback_vp8"); +} + +TEST(PipelineIntegrationPerfTest, VP9PlaybackBenchmark) { + RunVideoPlaybackBenchmark("bear-vp9.webm", "clockless_video_playback_vp9"); +} + +TEST(PipelineIntegrationPerfTest, TheoraPlaybackBenchmark) { + RunVideoPlaybackBenchmark("bear.ogv", "clockless_video_playback_theora"); +} + +#if defined(USE_PROPRIETARY_CODECS) +TEST(PipelineIntegrationPerfTest, MP4PlaybackBenchmark) { + RunVideoPlaybackBenchmark("bear-1280x720.mp4", + "clockless_video_playback_mp4"); } +#endif } // namespace media diff --git a/media/filters/pipeline_integration_test_base.cc b/media/filters/pipeline_integration_test_base.cc index 3b0010c..4001283 100644 --- a/media/filters/pipeline_integration_test_base.cc +++ b/media/filters/pipeline_integration_test_base.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/memory/scoped_vector.h" +#include "media/base/clock.h" #include "media/base/media_log.h" #include "media/filters/audio_renderer_impl.h" #include "media/filters/chunk_demuxer.h" @@ -122,6 +123,9 @@ bool PipelineIntegrationTestBase::Start(const base::FilePath& file_path, kTestType test_type) { hashing_enabled_ = test_type == kHashed; clockless_playback_ = test_type == kClockless; + if (clockless_playback_) { + pipeline_->SetClockForTesting(new Clock(&dummy_clock_)); + } return Start(file_path, expected_status); } @@ -229,30 +233,29 @@ PipelineIntegrationTestBase::CreateFilterCollection( scoped_ptr<FilterCollection> collection(new FilterCollection()); collection->SetDemuxer(demuxer_.get()); - if (!clockless_playback_) { - ScopedVector<VideoDecoder> video_decoders; - video_decoders.push_back( - new VpxVideoDecoder(message_loop_.message_loop_proxy())); - video_decoders.push_back( - new FFmpegVideoDecoder(message_loop_.message_loop_proxy())); - - // Disable frame dropping if hashing is enabled. - scoped_ptr<VideoRenderer> renderer(new VideoRendererImpl( - message_loop_.message_loop_proxy(), - video_decoders.Pass(), - base::Bind(&PipelineIntegrationTestBase::SetDecryptor, - base::Unretained(this), - decryptor), - base::Bind(&PipelineIntegrationTestBase::OnVideoRendererPaint, - base::Unretained(this)), - base::Bind(&PipelineIntegrationTestBase::OnSetOpaque, - base::Unretained(this)), - !hashing_enabled_)); - collection->SetVideoRenderer(renderer.Pass()); + ScopedVector<VideoDecoder> video_decoders; + video_decoders.push_back( + new VpxVideoDecoder(message_loop_.message_loop_proxy())); + video_decoders.push_back( + new FFmpegVideoDecoder(message_loop_.message_loop_proxy())); + + // Disable frame dropping if hashing is enabled. + scoped_ptr<VideoRenderer> renderer(new VideoRendererImpl( + message_loop_.message_loop_proxy(), + video_decoders.Pass(), + base::Bind(&PipelineIntegrationTestBase::SetDecryptor, + base::Unretained(this), + decryptor), + base::Bind(&PipelineIntegrationTestBase::OnVideoRendererPaint, + base::Unretained(this)), + base::Bind(&PipelineIntegrationTestBase::OnSetOpaque, + base::Unretained(this)), + false)); + collection->SetVideoRenderer(renderer.Pass()); + if (!clockless_playback_) { audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy()); } else { - // audio only for clockless_playback_ clockless_audio_sink_ = new ClocklessAudioSink(); } @@ -314,4 +317,9 @@ base::TimeDelta PipelineIntegrationTestBase::GetAudioTime() { return clockless_audio_sink_->render_time(); } +base::TimeTicks DummyTickClock::NowTicks() { + now_ += base::TimeDelta::FromSeconds(60); + return now_; +} + } // namespace media diff --git a/media/filters/pipeline_integration_test_base.h b/media/filters/pipeline_integration_test_base.h index 00dcfb8..d162d0b 100644 --- a/media/filters/pipeline_integration_test_base.h +++ b/media/filters/pipeline_integration_test_base.h @@ -31,6 +31,17 @@ extern const char kNullVideoHash[]; // Empty hash string. Used to verify empty audio tracks. extern const char kNullAudioHash[]; +// Dummy tick clock which advances extremely quickly (1 minute every time +// NowTicks() is called). +class DummyTickClock : public base::TickClock { + public: + DummyTickClock() : now_() {} + virtual ~DummyTickClock() {} + virtual base::TimeTicks NowTicks() OVERRIDE; + private: + base::TimeTicks now_; +}; + // Integration tests for Pipeline. Real demuxers, real decoders, and // base renderer implementations are used to verify pipeline functionality. The // renderers used in these tests rely heavily on the AudioRendererBase & @@ -97,6 +108,7 @@ class PipelineIntegrationTestBase { PipelineStatus pipeline_status_; Demuxer::NeedKeyCB need_key_cb_; VideoFrame::Format last_video_frame_format_; + DummyTickClock dummy_clock_; void OnStatusCallbackChecked(PipelineStatus expected_status, PipelineStatus status); diff --git a/media/test/data/bear-vp9.webm b/media/test/data/bear-vp9.webm Binary files differindex d080589..18e8087 100644 --- a/media/test/data/bear-vp9.webm +++ b/media/test/data/bear-vp9.webm |