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 56 matching lines...) Loading... |
67 uint64 seek_target_ms; | 67 uint64 seek_target_ms; |
68 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); | 68 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); |
69 scoped_ptr<media::FileDataSource> file_data_source( | 69 scoped_ptr<media::FileDataSource> file_data_source( |
70 new media::FileDataSource()); | 70 new media::FileDataSource()); |
71 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1]))); | 71 CHECK(file_data_source->Initialize(base::FilePath::FromUTF8Unsafe(argv[1]))); |
72 | 72 |
73 DemuxerHostImpl host; | 73 DemuxerHostImpl host; |
74 base::MessageLoop loop; | 74 base::MessageLoop loop; |
75 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); | 75 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); |
76 media::Demuxer::NeedKeyCB need_key_cb = base::Bind(&NeedKey); | 76 media::Demuxer::NeedKeyCB need_key_cb = base::Bind(&NeedKey); |
| 77 media::FFmpegAddTextTrackCB add_text_track_cb; |
77 scoped_ptr<media::FFmpegDemuxer> demuxer( | 78 scoped_ptr<media::FFmpegDemuxer> demuxer( |
78 new media::FFmpegDemuxer(loop.message_loop_proxy(), | 79 new media::FFmpegDemuxer(loop.message_loop_proxy(), |
79 file_data_source.get(), | 80 file_data_source.get(), |
80 need_key_cb, | 81 need_key_cb, |
| 82 add_text_track_cb, |
81 new media::MediaLog())); | 83 new media::MediaLog())); |
82 demuxer->Initialize(&host, quitter); | 84 demuxer->Initialize(&host, quitter); |
83 loop.Run(); | 85 loop.Run(); |
84 | 86 |
85 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); | 87 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); |
86 loop.Run(); | 88 loop.Run(); |
87 | 89 |
88 uint64 audio_seeked_to_ms; | 90 uint64 audio_seeked_to_ms; |
89 uint64 video_seeked_to_ms; | 91 uint64 video_seeked_to_ms; |
90 media::DemuxerStream* audio_stream = | 92 media::DemuxerStream* audio_stream = |
(...skipping 12 matching lines...) Loading... |
103 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 105 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
104 loop.Run(); | 106 loop.Run(); |
105 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 107 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
106 } | 108 } |
107 | 109 |
108 demuxer->Stop(base::Bind(&base::MessageLoop::Quit, base::Unretained(&loop))); | 110 demuxer->Stop(base::Bind(&base::MessageLoop::Quit, base::Unretained(&loop))); |
109 loop.Run(); | 111 loop.Run(); |
110 | 112 |
111 return 0; | 113 return 0; |
112 } | 114 } |
OLD | NEW |