OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 void QuitMessageLoop(base::MessageLoop* loop, media::PipelineStatus status) { | 39 void QuitMessageLoop(base::MessageLoop* loop, media::PipelineStatus status) { |
40 CHECK_EQ(status, media::PIPELINE_OK); | 40 CHECK_EQ(status, media::PIPELINE_OK); |
41 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); | 41 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
42 } | 42 } |
43 | 43 |
44 void TimestampExtractor(uint64* timestamp_ms, | 44 void TimestampExtractor(uint64* timestamp_ms, |
45 base::MessageLoop* loop, | 45 base::MessageLoop* loop, |
46 media::DemuxerStream::Status status, | 46 media::DemuxerStream::Status status, |
47 const scoped_refptr<media::DecoderBuffer>& buffer) { | 47 const scoped_refptr<media::DecoderBuffer>& buffer) { |
48 CHECK_EQ(status, media::DemuxerStream::kOk); | 48 CHECK_EQ(status, media::DemuxerStream::kOk); |
49 if (buffer->GetTimestamp() == media::kNoTimestamp()) | 49 if (buffer->timestamp() == media::kNoTimestamp()) |
50 *timestamp_ms = -1; | 50 *timestamp_ms = -1; |
51 else | 51 else |
52 *timestamp_ms = buffer->GetTimestamp().InMillisecondsF(); | 52 *timestamp_ms = buffer->timestamp().InMillisecondsF(); |
53 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); | 53 loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
54 } | 54 } |
55 | 55 |
56 static void NeedKey(const std::string& type, scoped_ptr<uint8[]> init_data, | 56 static void NeedKey(const std::string& type, scoped_ptr<uint8[]> init_data, |
57 int init_data_size) { | 57 int init_data_size) { |
58 LOG(INFO) << "File is encrypted."; | 58 LOG(INFO) << "File is encrypted."; |
59 } | 59 } |
60 | 60 |
61 int main(int argc, char** argv) { | 61 int main(int argc, char** argv) { |
62 base::AtExitManager at_exit; | 62 base::AtExitManager at_exit; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 99 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
100 loop.Run(); | 100 loop.Run(); |
101 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 101 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
102 } | 102 } |
103 | 103 |
104 demuxer->Stop(base::Bind(&base::MessageLoop::Quit, base::Unretained(&loop))); | 104 demuxer->Stop(base::Bind(&base::MessageLoop::Quit, base::Unretained(&loop))); |
105 loop.Run(); | 105 loop.Run(); |
106 | 106 |
107 return 0; | 107 return 0; |
108 } | 108 } |
OLD | NEW |