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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} | 31 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} |
32 virtual void AddTextStream(media::DemuxerStream* text_stream, | 32 virtual void AddTextStream(media::DemuxerStream* text_stream, |
33 const media::TextTrackConfig& config) OVERRIDE {} | 33 const media::TextTrackConfig& config) OVERRIDE {} |
34 virtual void RemoveTextStream(media::DemuxerStream* text_stream) OVERRIDE {} | 34 virtual void RemoveTextStream(media::DemuxerStream* text_stream) OVERRIDE {} |
35 | 35 |
36 private: | 36 private: |
37 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl); | 37 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl); |
38 }; | 38 }; |
39 | 39 |
40 static void QuitLoopWithStatus(base::MessageLoop* message_loop, | 40 static void QuitLoopWithStatus(base::MessageLoop* message_loop, |
41 media::PipelineStatus status) { | 41 media::PipelineStatus status) { |
42 CHECK_EQ(status, media::PIPELINE_OK); | 42 CHECK_EQ(status, media::PIPELINE_OK); |
43 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 43 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
44 } | 44 } |
45 | 45 |
46 static void NeedKey(const std::string& type, | 46 static void NeedKey(const std::string& type, |
47 const std::vector<uint8>& init_data) { | 47 const std::vector<uint8>& init_data) { |
48 VLOG(0) << "File is encrypted."; | 48 VLOG(0) << "File is encrypted."; |
49 } | 49 } |
50 | 50 |
51 typedef std::vector<media::DemuxerStream* > Streams; | 51 typedef std::vector<media::DemuxerStream* > Streams; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 message_loop.Run(); | 187 message_loop.Run(); |
188 StreamReader stream_reader(&demuxer, false); | 188 StreamReader stream_reader(&demuxer, false); |
189 | 189 |
190 // Benchmark. | 190 // Benchmark. |
191 base::TimeTicks start = base::TimeTicks::HighResNow(); | 191 base::TimeTicks start = base::TimeTicks::HighResNow(); |
192 while (!stream_reader.IsDone()) { | 192 while (!stream_reader.IsDone()) { |
193 stream_reader.Read(); | 193 stream_reader.Read(); |
194 } | 194 } |
195 base::TimeTicks end = base::TimeTicks::HighResNow(); | 195 base::TimeTicks end = base::TimeTicks::HighResNow(); |
196 total_time += (end - start).InSecondsF(); | 196 total_time += (end - start).InSecondsF(); |
197 demuxer.Stop(base::Bind( | 197 demuxer.Stop(); |
198 &QuitLoopWithStatus, &message_loop, PIPELINE_OK)); | 198 QuitLoopWithStatus(&message_loop, PIPELINE_OK); |
199 message_loop.Run(); | 199 message_loop.Run(); |
200 } | 200 } |
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 } |
(...skipping 14 matching lines...) Expand all Loading... |
223 #endif | 223 #endif |
224 #if defined(OS_CHROMEOS) | 224 #if defined(OS_CHROMEOS) |
225 RunDemuxerBenchmark("bear.flac"); | 225 RunDemuxerBenchmark("bear.flac"); |
226 #endif | 226 #endif |
227 #if defined(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) | 227 #if defined(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) |
228 RunDemuxerBenchmark("bear.avi"); | 228 RunDemuxerBenchmark("bear.avi"); |
229 #endif | 229 #endif |
230 } | 230 } |
231 | 231 |
232 } // namespace media | 232 } // namespace media |
OLD | NEW |