| 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" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 index = i; | 171 index = i; |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 CHECK_GE(index, 0) << "Couldn't find a stream to read"; | 174 CHECK_GE(index, 0) << "Couldn't find a stream to read"; |
| 175 return index; | 175 return index; |
| 176 } | 176 } |
| 177 | 177 |
| 178 static void RunDemuxerBenchmark(const std::string& filename) { | 178 static void RunDemuxerBenchmark(const std::string& filename) { |
| 179 base::FilePath file_path(GetTestDataFilePath(filename)); | 179 base::FilePath file_path(GetTestDataFilePath(filename)); |
| 180 base::TimeDelta total_time; | 180 base::TimeDelta total_time; |
| 181 MediaLog media_log_; |
| 181 for (int i = 0; i < kBenchmarkIterations; ++i) { | 182 for (int i = 0; i < kBenchmarkIterations; ++i) { |
| 182 // Setup. | 183 // Setup. |
| 183 base::test::ScopedTaskScheduler scoped_task_scheduler; | 184 base::test::ScopedTaskScheduler scoped_task_scheduler; |
| 184 DemuxerHostImpl demuxer_host; | 185 DemuxerHostImpl demuxer_host; |
| 185 FileDataSource data_source; | 186 FileDataSource data_source; |
| 186 ASSERT_TRUE(data_source.Initialize(file_path)); | 187 ASSERT_TRUE(data_source.Initialize(file_path)); |
| 187 | 188 |
| 188 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = | 189 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = |
| 189 base::Bind(&OnEncryptedMediaInitData); | 190 base::Bind(&OnEncryptedMediaInitData); |
| 190 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = | 191 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = |
| 191 base::Bind(&OnMediaTracksUpdated); | 192 base::Bind(&OnMediaTracksUpdated); |
| 192 FFmpegDemuxer demuxer(base::ThreadTaskRunnerHandle::Get(), &data_source, | 193 FFmpegDemuxer demuxer(base::ThreadTaskRunnerHandle::Get(), &data_source, |
| 193 encrypted_media_init_data_cb, tracks_updated_cb, | 194 encrypted_media_init_data_cb, tracks_updated_cb, |
| 194 new MediaLog()); | 195 &media_log_); |
| 195 | 196 |
| 196 { | 197 { |
| 197 base::RunLoop run_loop; | 198 base::RunLoop run_loop; |
| 198 demuxer.Initialize( | 199 demuxer.Initialize( |
| 199 &demuxer_host, | 200 &demuxer_host, |
| 200 base::Bind(&QuitLoopWithStatus, run_loop.QuitClosure()), false); | 201 base::Bind(&QuitLoopWithStatus, run_loop.QuitClosure()), false); |
| 201 run_loop.Run(); | 202 run_loop.Run(); |
| 202 } | 203 } |
| 203 | 204 |
| 204 StreamReader stream_reader(&demuxer, false); | 205 StreamReader stream_reader(&demuxer, false); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 231 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 232 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 232 RunDemuxerBenchmark("bear-1280x720.mp4"); | 233 RunDemuxerBenchmark("bear-1280x720.mp4"); |
| 233 RunDemuxerBenchmark("sfx.mp3"); | 234 RunDemuxerBenchmark("sfx.mp3"); |
| 234 #endif | 235 #endif |
| 235 #if BUILDFLAG(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) | 236 #if BUILDFLAG(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) |
| 236 RunDemuxerBenchmark("bear.avi"); | 237 RunDemuxerBenchmark("bear.avi"); |
| 237 #endif | 238 #endif |
| 238 } | 239 } |
| 239 | 240 |
| 240 } // namespace media | 241 } // namespace media |
| OLD | NEW |