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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 uint64 seek_target_ms; | 60 uint64 seek_target_ms; |
61 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); | 61 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); |
62 scoped_refptr<media::FileDataSource> file_data_source( | 62 scoped_refptr<media::FileDataSource> file_data_source( |
63 new media::FileDataSource()); | 63 new media::FileDataSource()); |
64 CHECK(file_data_source->Initialize(argv[1])); | 64 CHECK(file_data_source->Initialize(argv[1])); |
65 | 65 |
66 DemuxerHostImpl host; | 66 DemuxerHostImpl host; |
67 MessageLoop loop; | 67 MessageLoop loop; |
68 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); | 68 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); |
69 scoped_refptr<media::FFmpegDemuxer> demuxer( | 69 scoped_refptr<media::FFmpegDemuxer> demuxer( |
70 new media::FFmpegDemuxer(&loop, file_data_source)); | 70 new media::FFmpegDemuxer(loop.message_loop_proxy(), file_data_source)); |
71 demuxer->Initialize(&host, quitter); | 71 demuxer->Initialize(&host, quitter); |
72 loop.Run(); | 72 loop.Run(); |
73 | 73 |
74 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); | 74 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); |
75 loop.Run(); | 75 loop.Run(); |
76 | 76 |
77 uint64 audio_seeked_to_ms; | 77 uint64 audio_seeked_to_ms; |
78 uint64 video_seeked_to_ms; | 78 uint64 video_seeked_to_ms; |
79 scoped_refptr<media::DemuxerStream> audio_stream( | 79 scoped_refptr<media::DemuxerStream> audio_stream( |
80 demuxer->GetStream(media::DemuxerStream::AUDIO)); | 80 demuxer->GetStream(media::DemuxerStream::AUDIO)); |
(...skipping 11 matching lines...) Expand all Loading... |
92 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 92 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
93 loop.Run(); | 93 loop.Run(); |
94 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 94 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
95 } | 95 } |
96 | 96 |
97 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); | 97 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); |
98 loop.Run(); | 98 loop.Run(); |
99 | 99 |
100 return 0; | 100 return 0; |
101 } | 101 } |
OLD | NEW |