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

Side by Side Diff: media/tools/seek_tester/seek_tester.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/tools/player_x11/player_x11.cc ('k') | media/webm/webm_stream_parser.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 // This standalone binary is a helper for diagnosing seek behavior of the 5 // This standalone binary is a helper for diagnosing seek behavior of the
6 // demuxer setup in media/ code. It answers the question: "if I ask the demuxer 6 // demuxer setup in media/ code. It answers the question: "if I ask the demuxer
7 // to Seek to X ms, where will it actually seek to? (necessitating 7 // to Seek to X ms, where will it actually seek to? (necessitating
8 // frame-dropping until the original seek target is reached)". Sample run: 8 // frame-dropping until the original seek target is reached)". Sample run:
9 // 9 //
10 // $ ./out/Debug/seek_tester .../LayoutTests/media/content/test.ogv 6300 10 // $ ./out/Debug/seek_tester .../LayoutTests/media/content/test.ogv 6300
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 media::DemuxerStream::Status status, 47 media::DemuxerStream::Status status,
48 const scoped_refptr<media::DecoderBuffer>& buffer) { 48 const scoped_refptr<media::DecoderBuffer>& buffer) {
49 CHECK_EQ(status, media::DemuxerStream::kOk); 49 CHECK_EQ(status, media::DemuxerStream::kOk);
50 if (buffer->timestamp() == media::kNoTimestamp()) 50 if (buffer->timestamp() == media::kNoTimestamp())
51 *timestamp_ms = -1; 51 *timestamp_ms = -1;
52 else 52 else
53 *timestamp_ms = buffer->timestamp().InMillisecondsF(); 53 *timestamp_ms = buffer->timestamp().InMillisecondsF();
54 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); 54 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
55 } 55 }
56 56
57 static void NeedKey(const std::string& type, scoped_ptr<uint8[]> init_data, 57 static void NeedKey(const std::string& type,
58 int init_data_size) { 58 const std::vector<uint8>& init_data) {
59 LOG(INFO) << "File is encrypted."; 59 LOG(INFO) << "File is encrypted.";
60 } 60 }
61 61
62 int main(int argc, char** argv) { 62 int main(int argc, char** argv) {
63 base::AtExitManager at_exit; 63 base::AtExitManager at_exit;
64 media::InitializeMediaLibraryForTesting(); 64 media::InitializeMediaLibraryForTesting();
65 65
66 CHECK_EQ(argc, 3) << "\nUsage: " << argv[0] << " <file> <seekTimeInMs>"; 66 CHECK_EQ(argc, 3) << "\nUsage: " << argv[0] << " <file> <seekTimeInMs>";
67 uint64 seek_target_ms; 67 uint64 seek_target_ms;
68 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); 68 CHECK(base::StringToUint64(argv[2], &seek_target_ms));
69 scoped_ptr<media::FileDataSource> file_data_source( 69 scoped_ptr<media::FileDataSource> file_data_source(
70 new media::FileDataSource()); 70 new media::FileDataSource());
71 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1]))); 71 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1])));
72 72
73 DemuxerHostImpl host; 73 DemuxerHostImpl host;
74 base::MessageLoop loop; 74 base::MessageLoop loop;
75 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); 75 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop);
76 media::FFmpegNeedKeyCB need_key_cb = base::Bind(&NeedKey); 76 media::Demuxer::NeedKeyCB need_key_cb = base::Bind(&NeedKey);
77 scoped_ptr<media::FFmpegDemuxer> demuxer( 77 scoped_ptr<media::FFmpegDemuxer> demuxer(
78 new media::FFmpegDemuxer(loop.message_loop_proxy(), 78 new media::FFmpegDemuxer(loop.message_loop_proxy(),
79 file_data_source.get(), 79 file_data_source.get(),
80 need_key_cb, 80 need_key_cb,
81 new media::MediaLog())); 81 new media::MediaLog()));
82 demuxer->Initialize(&host, quitter); 82 demuxer->Initialize(&host, quitter);
83 loop.Run(); 83 loop.Run();
84 84
85 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); 85 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter);
86 loop.Run(); 86 loop.Run();
(...skipping 16 matching lines...) Expand all
103 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); 103 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop));
104 loop.Run(); 104 loop.Run();
105 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; 105 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms";
106 } 106 }
107 107
108 demuxer->Stop(base::Bind(&base::MessageLoop::Quit, base::Unretained(&loop))); 108 demuxer->Stop(base::Bind(&base::MessageLoop::Quit, base::Unretained(&loop)));
109 loop.Run(); 109 loop.Run();
110 110
111 return 0; 111 return 0;
112 } 112 }
OLDNEW
« no previous file with comments | « media/tools/player_x11/player_x11.cc ('k') | media/webm/webm_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698