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