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 |
11 // [0207/130327:INFO:seek_tester.cc(63)] Requested: 6123ms | 11 // [0207/130327:INFO:seek_tester.cc(63)] Requested: 6123ms |
12 // [0207/130327:INFO:seek_tester.cc(68)] audio seeked to: 5526ms | 12 // [0207/130327:INFO:seek_tester.cc(68)] audio seeked to: 5526ms |
13 // [0207/130327:INFO:seek_tester.cc(74)] video seeked to: 5577ms | 13 // [0207/130327:INFO:seek_tester.cc(74)] video seeked to: 5577ms |
14 | 14 |
15 | 15 |
16 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
21 #include "media/base/media.h" | 21 #include "media/base/media.h" |
22 #include "media/filters/ffmpeg_demuxer.h" | 22 #include "media/filters/ffmpeg_demuxer.h" |
23 #include "media/filters/file_data_source.h" | 23 #include "media/filters/file_data_source.h" |
24 | 24 |
25 class DemuxerHostImpl : public media::DemuxerHost { | 25 class DemuxerHostImpl : public media::DemuxerHost { |
26 public: | 26 public: |
27 // DataSourceHost implementation. | 27 // DataSourceHost implementation. |
28 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {} | 28 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {} |
29 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {} | 29 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {} |
| 30 virtual void AddBufferedTimeRange(base::TimeDelta start, |
| 31 base::TimeDelta end) OVERRIDE {} |
30 | 32 |
31 // DemuxerHost implementation. | 33 // DemuxerHost implementation. |
32 virtual void SetDuration(base::TimeDelta duration) OVERRIDE {} | 34 virtual void SetDuration(base::TimeDelta duration) OVERRIDE {} |
33 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} | 35 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} |
34 }; | 36 }; |
35 | 37 |
36 void QuitMessageLoop(MessageLoop* loop, media::PipelineStatus status) { | 38 void QuitMessageLoop(MessageLoop* loop, media::PipelineStatus status) { |
37 CHECK_EQ(status, media::PIPELINE_OK); | 39 CHECK_EQ(status, media::PIPELINE_OK); |
38 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 40 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
39 } | 41 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 90 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
89 loop.Run(); | 91 loop.Run(); |
90 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 92 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
91 } | 93 } |
92 | 94 |
93 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); | 95 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); |
94 loop.Run(); | 96 loop.Run(); |
95 | 97 |
96 return 0; | 98 return 0; |
97 } | 99 } |
OLD | NEW |