Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: media/tools/demuxer_bench/demuxer_bench.cc

Issue 10829470: Support for parsing encrypted WebM streams by src. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tool player_x11 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/media.gyp ('k') | media/tools/player_x11/player_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // demuxer_bench is a standalone benchmarking tool for FFmpegDemuxer. It 5 // demuxer_bench is a standalone benchmarking tool for FFmpegDemuxer. It
6 // simulates the reading requirements for playback by reading from the stream 6 // simulates the reading requirements for playback by reading from the stream
7 // that has the earliest timestamp. 7 // that has the earliest timestamp.
8 8
9 #include <iostream> 9 #include <iostream>
10 10
(...skipping 25 matching lines...) Expand all
36 private: 36 private:
37 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl); 37 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl);
38 }; 38 };
39 39
40 void QuitLoopWithStatus(MessageLoop* message_loop, 40 void QuitLoopWithStatus(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, MessageLoop::QuitWhenIdleClosure()); 43 message_loop->PostTask(FROM_HERE, MessageLoop::QuitWhenIdleClosure());
44 } 44 }
45 45
46 static void NeedKey(const std::string& type, scoped_array<uint8> init_data,
47 int init_data_size) {
48 LOG(INFO) << "File is encrypted.";
49 }
50
46 typedef std::vector<scoped_refptr<media::DemuxerStream> > Streams; 51 typedef std::vector<scoped_refptr<media::DemuxerStream> > Streams;
47 52
48 // Simulates playback reading requirements by reading from each stream 53 // Simulates playback reading requirements by reading from each stream
49 // present in |demuxer| in as-close-to-monotonically-increasing timestamp order. 54 // present in |demuxer| in as-close-to-monotonically-increasing timestamp order.
50 class StreamReader { 55 class StreamReader {
51 public: 56 public:
52 explicit StreamReader(const scoped_refptr<media::Demuxer>& demuxer); 57 explicit StreamReader(const scoped_refptr<media::Demuxer>& demuxer);
53 ~StreamReader(); 58 ~StreamReader();
54 59
55 // Performs a single step read. 60 // Performs a single step read.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 175
171 MessageLoop message_loop; 176 MessageLoop message_loop;
172 DemuxerHostImpl demuxer_host; 177 DemuxerHostImpl demuxer_host;
173 base::FilePath file_path(cmd_line->GetArgs()[0]); 178 base::FilePath file_path(cmd_line->GetArgs()[0]);
174 179
175 // Setup. 180 // Setup.
176 scoped_refptr<media::FileDataSource> data_source = 181 scoped_refptr<media::FileDataSource> data_source =
177 new media::FileDataSource(); 182 new media::FileDataSource();
178 CHECK(data_source->Initialize(file_path)); 183 CHECK(data_source->Initialize(file_path));
179 184
185 media::FFmpegNeedKeyCB need_key_cb = base::Bind(&NeedKey);
180 scoped_refptr<media::FFmpegDemuxer> demuxer = 186 scoped_refptr<media::FFmpegDemuxer> demuxer =
181 new media::FFmpegDemuxer(message_loop.message_loop_proxy(), data_source); 187 new media::FFmpegDemuxer(message_loop.message_loop_proxy(), data_source,
188 need_key_cb);
182 189
183 demuxer->Initialize(&demuxer_host, base::Bind( 190 demuxer->Initialize(&demuxer_host, base::Bind(
184 &QuitLoopWithStatus, &message_loop)); 191 &QuitLoopWithStatus, &message_loop));
185 message_loop.Run(); 192 message_loop.Run();
186 193
187 StreamReader stream_reader(demuxer); 194 StreamReader stream_reader(demuxer);
188 195
189 // Benchmark. 196 // Benchmark.
190 base::TimeTicks start = base::TimeTicks::HighResNow(); 197 base::TimeTicks start = base::TimeTicks::HighResNow();
191 while (!stream_reader.IsDone()) { 198 while (!stream_reader.IsDone()) {
(...skipping 18 matching lines...) Expand all
210 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl; 217 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl;
211 } 218 }
212 219
213 // Teardown. 220 // Teardown.
214 demuxer->Stop(base::Bind( 221 demuxer->Stop(base::Bind(
215 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK)); 222 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK));
216 message_loop.Run(); 223 message_loop.Run();
217 224
218 return 0; 225 return 0;
219 } 226 }
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | media/tools/player_x11/player_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698