| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 int main(int argc, char** argv) { | 56 int main(int argc, char** argv) { |
| 57 base::AtExitManager at_exit; | 57 base::AtExitManager at_exit; |
| 58 media::InitializeMediaLibraryForTesting(); | 58 media::InitializeMediaLibraryForTesting(); |
| 59 | 59 |
| 60 CHECK_EQ(argc, 3) << "\nUsage: " << argv[0] << " <file> <seekTimeInMs>"; | 60 CHECK_EQ(argc, 3) << "\nUsage: " << argv[0] << " <file> <seekTimeInMs>"; |
| 61 uint64 seek_target_ms; | 61 uint64 seek_target_ms; |
| 62 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); | 62 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); |
| 63 scoped_refptr<media::FileDataSource> file_data_source( | 63 scoped_refptr<media::FileDataSource> file_data_source( |
| 64 new media::FileDataSource()); | 64 new media::FileDataSource()); |
| 65 CHECK(file_data_source->Initialize(FilePath::FromUTF8Unsafe(argv[1]))); | 65 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1]))); |
| 66 | 66 |
| 67 DemuxerHostImpl host; | 67 DemuxerHostImpl host; |
| 68 MessageLoop loop; | 68 MessageLoop loop; |
| 69 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); | 69 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); |
| 70 scoped_refptr<media::FFmpegDemuxer> demuxer( | 70 scoped_refptr<media::FFmpegDemuxer> demuxer( |
| 71 new media::FFmpegDemuxer(loop.message_loop_proxy(), file_data_source)); | 71 new media::FFmpegDemuxer(loop.message_loop_proxy(), file_data_source)); |
| 72 demuxer->Initialize(&host, quitter); | 72 demuxer->Initialize(&host, quitter); |
| 73 loop.Run(); | 73 loop.Run(); |
| 74 | 74 |
| 75 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); | 75 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 93 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
| 94 loop.Run(); | 94 loop.Run(); |
| 95 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 95 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
| 96 } | 96 } |
| 97 | 97 |
| 98 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); | 98 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); |
| 99 loop.Run(); | 99 loop.Run(); |
| 100 | 100 |
| 101 return 0; | 101 return 0; |
| 102 } | 102 } |
| OLD | NEW |