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 23 matching lines...) Expand all Loading... |
34 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} | 34 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} |
35 }; | 35 }; |
36 | 36 |
37 void QuitMessageLoop(MessageLoop* loop, media::PipelineStatus status) { | 37 void QuitMessageLoop(MessageLoop* loop, media::PipelineStatus status) { |
38 CHECK_EQ(status, media::PIPELINE_OK); | 38 CHECK_EQ(status, media::PIPELINE_OK); |
39 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 39 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
40 } | 40 } |
41 | 41 |
42 void TimestampExtractor(uint64* timestamp_ms, | 42 void TimestampExtractor(uint64* timestamp_ms, |
43 MessageLoop* loop, | 43 MessageLoop* loop, |
44 const scoped_refptr<media::Buffer>& buffer) { | 44 const scoped_refptr<media::DecoderBuffer>& buffer) { |
45 if (buffer->GetTimestamp() == media::kNoTimestamp()) | 45 if (buffer->GetTimestamp() == media::kNoTimestamp()) |
46 *timestamp_ms = -1; | 46 *timestamp_ms = -1; |
47 else | 47 else |
48 *timestamp_ms = buffer->GetTimestamp().InMillisecondsF(); | 48 *timestamp_ms = buffer->GetTimestamp().InMillisecondsF(); |
49 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 49 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
50 } | 50 } |
51 | 51 |
52 int main(int argc, char** argv) { | 52 int main(int argc, char** argv) { |
53 base::AtExitManager at_exit; | 53 base::AtExitManager at_exit; |
54 media::InitializeMediaLibraryForTesting(); | 54 media::InitializeMediaLibraryForTesting(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 89 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
90 loop.Run(); | 90 loop.Run(); |
91 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 91 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
92 } | 92 } |
93 | 93 |
94 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); | 94 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); |
95 loop.Run(); | 95 loop.Run(); |
96 | 96 |
97 return 0; | 97 return 0; |
98 } | 98 } |
OLD | NEW |