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

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

Issue 23072043: Change NeedKeyCB to use std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix seek_tester, demuxer_bench, and player_x11 Created 7 years, 4 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/mp4/mp4_stream_parser_unittest.cc ('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 30 matching lines...) Expand all
41 private: 41 private:
42 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl); 42 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl);
43 }; 43 };
44 44
45 void QuitLoopWithStatus(base::MessageLoop* message_loop, 45 void QuitLoopWithStatus(base::MessageLoop* message_loop,
46 media::PipelineStatus status) { 46 media::PipelineStatus status) {
47 CHECK_EQ(status, media::PIPELINE_OK); 47 CHECK_EQ(status, media::PIPELINE_OK);
48 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 48 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
49 } 49 }
50 50
51 static void NeedKey(const std::string& type, scoped_ptr<uint8[]> init_data, 51 static void NeedKey(const std::string& type,
52 int init_data_size) { 52 const std::vector<uint8>& init_data) {
53 LOG(INFO) << "File is encrypted."; 53 LOG(INFO) << "File is encrypted.";
54 } 54 }
55 55
56 typedef std::vector<media::DemuxerStream* > Streams; 56 typedef std::vector<media::DemuxerStream* > Streams;
57 57
58 // Simulates playback reading requirements by reading from each stream 58 // Simulates playback reading requirements by reading from each stream
59 // present in |demuxer| in as-close-to-monotonically-increasing timestamp order. 59 // present in |demuxer| in as-close-to-monotonically-increasing timestamp order.
60 class StreamReader { 60 class StreamReader {
61 public: 61 public:
62 StreamReader(media::Demuxer* demuxer, bool enable_bitstream_converter); 62 StreamReader(media::Demuxer* demuxer, bool enable_bitstream_converter);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 base::MessageLoop message_loop; 189 base::MessageLoop message_loop;
190 DemuxerHostImpl demuxer_host; 190 DemuxerHostImpl demuxer_host;
191 base::FilePath file_path(cmd_line->GetArgs()[0]); 191 base::FilePath file_path(cmd_line->GetArgs()[0]);
192 192
193 // Setup. 193 // Setup.
194 media::FileDataSource data_source; 194 media::FileDataSource data_source;
195 CHECK(data_source.Initialize(file_path)); 195 CHECK(data_source.Initialize(file_path));
196 196
197 media::FFmpegNeedKeyCB need_key_cb = base::Bind(&NeedKey); 197 media::Demuxer::NeedKeyCB need_key_cb = base::Bind(&NeedKey);
198 media::FFmpegDemuxer demuxer(message_loop.message_loop_proxy(), 198 media::FFmpegDemuxer demuxer(message_loop.message_loop_proxy(),
199 &data_source, 199 &data_source,
200 need_key_cb, 200 need_key_cb,
201 new media::MediaLog()); 201 new media::MediaLog());
202 202
203 demuxer.Initialize(&demuxer_host, base::Bind( 203 demuxer.Initialize(&demuxer_host, base::Bind(
204 &QuitLoopWithStatus, &message_loop)); 204 &QuitLoopWithStatus, &message_loop));
205 message_loop.Run(); 205 message_loop.Run();
206 206
207 StreamReader stream_reader( 207 StreamReader stream_reader(
(...skipping 23 matching lines...) Expand all
231 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl; 231 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl;
232 } 232 }
233 233
234 // Teardown. 234 // Teardown.
235 demuxer.Stop(base::Bind( 235 demuxer.Stop(base::Bind(
236 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK)); 236 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK));
237 message_loop.Run(); 237 message_loop.Run();
238 238
239 return 0; 239 return 0;
240 } 240 }
OLDNEW
« no previous file with comments | « media/mp4/mp4_stream_parser_unittest.cc ('k') | media/tools/player_x11/player_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698