OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/media.h" | 10 #include "media/base/media.h" |
11 #include "media/base/media_log.h" | 11 #include "media/base/media_log.h" |
12 #include "media/base/test_data_util.h" | 12 #include "media/base/test_data_util.h" |
13 #include "media/filters/ffmpeg_demuxer.h" | 13 #include "media/filters/ffmpeg_demuxer.h" |
14 #include "media/filters/file_data_source.h" | 14 #include "media/filters/file_data_source.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "testing/perf/perf_test.h" | 16 #include "testing/perf/perf_test.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 static const int kBenchmarkIterations = 5000; | 20 static const int kBenchmarkIterations = 500; |
21 | 21 |
22 class DemuxerHostImpl : public media::DemuxerHost { | 22 class DemuxerHostImpl : public media::DemuxerHost { |
23 public: | 23 public: |
24 DemuxerHostImpl() {} | 24 DemuxerHostImpl() {} |
25 virtual ~DemuxerHostImpl() {} | 25 virtual ~DemuxerHostImpl() {} |
26 | 26 |
27 // DataSourceHost implementation. | 27 // DataSourceHost implementation. |
28 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {} | 28 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {} |
29 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {} | 29 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {} |
30 virtual void AddBufferedTimeRange(base::TimeDelta start, | 30 virtual void AddBufferedTimeRange(base::TimeDelta start, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 perf_test::PrintResult("demuxer_bench", | 202 perf_test::PrintResult("demuxer_bench", |
203 "", | 203 "", |
204 filename, | 204 filename, |
205 kBenchmarkIterations / total_time, | 205 kBenchmarkIterations / total_time, |
206 "runs/s", | 206 "runs/s", |
207 true); | 207 true); |
208 } | 208 } |
209 | 209 |
210 TEST(DemuxerPerfTest, Demuxer) { | 210 TEST(DemuxerPerfTest, Demuxer) { |
211 RunDemuxerBenchmark("media/test/data/bear.ogv"); | 211 RunDemuxerBenchmark("bear.ogv"); |
212 RunDemuxerBenchmark("media/test/data/bear-640x360.webm"); | 212 RunDemuxerBenchmark("bear-640x360.webm"); |
213 RunDemuxerBenchmark("media/test/data/sfx_s16le.wav"); | 213 RunDemuxerBenchmark("sfx_s16le.wav"); |
214 #if defined(USE_PROPRIETARY_CODECS) | 214 #if defined(USE_PROPRIETARY_CODECS) |
215 RunDemuxerBenchmark("media/test/data/bear-1280x720.mp4"); | 215 RunDemuxerBenchmark("bear-1280x720.mp4"); |
216 RunDemuxerBenchmark("media/test/data/sfx.mp3"); | 216 RunDemuxerBenchmark("sfx.mp3"); |
217 #endif | 217 #endif |
218 #if defined(OS_CHROMEOS) | 218 #if defined(OS_CHROMEOS) |
219 RunDemuxerBenchmark("media/test/data/bear.flac"); | 219 RunDemuxerBenchmark("bear.flac"); |
220 #endif | 220 #endif |
221 #if defined(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) | 221 #if defined(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) |
222 RunDemuxerBenchmark("media/test/data/bear.avi"); | 222 RunDemuxerBenchmark("bear.avi"); |
223 #endif | 223 #endif |
224 } | 224 } |
225 | 225 |
226 } // namespace media | 226 } // namespace media |
OLD | NEW |