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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | |
13 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
15 #include "base/test/scoped_task_scheduler.h" | 14 #include "base/test/scoped_task_environment.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
17 #include "base/time/time.h" | 16 #include "base/time/time.h" |
18 #include "build/build_config.h" | 17 #include "build/build_config.h" |
19 #include "media/base/media.h" | 18 #include "media/base/media.h" |
20 #include "media/base/media_log.h" | 19 #include "media/base/media_log.h" |
21 #include "media/base/media_tracks.h" | 20 #include "media/base/media_tracks.h" |
22 #include "media/base/test_data_util.h" | 21 #include "media/base/test_data_util.h" |
23 #include "media/base/timestamp_constants.h" | 22 #include "media/base/timestamp_constants.h" |
24 #include "media/filters/ffmpeg_demuxer.h" | 23 #include "media/filters/ffmpeg_demuxer.h" |
25 #include "media/filters/file_data_source.h" | 24 #include "media/filters/file_data_source.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 CHECK_GE(index, 0) << "Couldn't find a stream to read"; | 173 CHECK_GE(index, 0) << "Couldn't find a stream to read"; |
175 return index; | 174 return index; |
176 } | 175 } |
177 | 176 |
178 static void RunDemuxerBenchmark(const std::string& filename) { | 177 static void RunDemuxerBenchmark(const std::string& filename) { |
179 base::FilePath file_path(GetTestDataFilePath(filename)); | 178 base::FilePath file_path(GetTestDataFilePath(filename)); |
180 base::TimeDelta total_time; | 179 base::TimeDelta total_time; |
181 MediaLog media_log_; | 180 MediaLog media_log_; |
182 for (int i = 0; i < kBenchmarkIterations; ++i) { | 181 for (int i = 0; i < kBenchmarkIterations; ++i) { |
183 // Setup. | 182 // Setup. |
184 base::test::ScopedTaskScheduler scoped_task_scheduler; | 183 base::test::ScopedTaskEnvironment scoped_task_environment_; |
185 DemuxerHostImpl demuxer_host; | 184 DemuxerHostImpl demuxer_host; |
186 FileDataSource data_source; | 185 FileDataSource data_source; |
187 ASSERT_TRUE(data_source.Initialize(file_path)); | 186 ASSERT_TRUE(data_source.Initialize(file_path)); |
188 | 187 |
189 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = | 188 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = |
190 base::Bind(&OnEncryptedMediaInitData); | 189 base::Bind(&OnEncryptedMediaInitData); |
191 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = | 190 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = |
192 base::Bind(&OnMediaTracksUpdated); | 191 base::Bind(&OnMediaTracksUpdated); |
193 FFmpegDemuxer demuxer(base::ThreadTaskRunnerHandle::Get(), &data_source, | 192 FFmpegDemuxer demuxer(base::ThreadTaskRunnerHandle::Get(), &data_source, |
194 encrypted_media_init_data_cb, tracks_updated_cb, | 193 encrypted_media_init_data_cb, tracks_updated_cb, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 231 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
233 RunDemuxerBenchmark("bear-1280x720.mp4"); | 232 RunDemuxerBenchmark("bear-1280x720.mp4"); |
234 RunDemuxerBenchmark("sfx.mp3"); | 233 RunDemuxerBenchmark("sfx.mp3"); |
235 #endif | 234 #endif |
236 #if BUILDFLAG(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) | 235 #if BUILDFLAG(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) |
237 RunDemuxerBenchmark("bear.avi"); | 236 RunDemuxerBenchmark("bear.avi"); |
238 #endif | 237 #endif |
239 } | 238 } |
240 | 239 |
241 } // namespace media | 240 } // namespace media |
OLD | NEW |