| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 CHECK_EQ(argc, 3) << "\nUsage: " << argv[0] << " <file> <seekTimeInMs>"; | 44 CHECK_EQ(argc, 3) << "\nUsage: " << argv[0] << " <file> <seekTimeInMs>"; |
| 45 uint64 seek_target_ms; | 45 uint64 seek_target_ms; |
| 46 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); | 46 CHECK(base::StringToUint64(argv[2], &seek_target_ms)); |
| 47 scoped_refptr<media::FileDataSource> file_data_source( | 47 scoped_refptr<media::FileDataSource> file_data_source( |
| 48 new media::FileDataSource()); | 48 new media::FileDataSource()); |
| 49 CHECK_EQ(file_data_source->Initialize(argv[1]), media::PIPELINE_OK); | 49 CHECK_EQ(file_data_source->Initialize(argv[1]), media::PIPELINE_OK); |
| 50 | 50 |
| 51 MessageLoop loop; | 51 MessageLoop loop; |
| 52 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); | 52 media::PipelineStatusCB quitter = base::Bind(&QuitMessageLoop, &loop); |
| 53 scoped_refptr<media::FFmpegDemuxer> demuxer( | 53 scoped_refptr<media::FFmpegDemuxer> demuxer( |
| 54 new media::FFmpegDemuxer(&loop, true)); | 54 new media::FFmpegDemuxer(&loop, file_data_source, true)); |
| 55 demuxer->Initialize(file_data_source, quitter); | 55 demuxer->Initialize(quitter); |
| 56 loop.Run(); | 56 loop.Run(); |
| 57 | 57 |
| 58 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); | 58 demuxer->Seek(base::TimeDelta::FromMilliseconds(seek_target_ms), quitter); |
| 59 loop.Run(); | 59 loop.Run(); |
| 60 | 60 |
| 61 uint64 audio_seeked_to_ms; | 61 uint64 audio_seeked_to_ms; |
| 62 uint64 video_seeked_to_ms; | 62 uint64 video_seeked_to_ms; |
| 63 scoped_refptr<media::DemuxerStream> audio_stream( | 63 scoped_refptr<media::DemuxerStream> audio_stream( |
| 64 demuxer->GetStream(media::DemuxerStream::AUDIO)); | 64 demuxer->GetStream(media::DemuxerStream::AUDIO)); |
| 65 scoped_refptr<media::DemuxerStream> video_stream( | 65 scoped_refptr<media::DemuxerStream> video_stream( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); | 76 base::Bind(&TimestampExtractor, &video_seeked_to_ms, &loop)); |
| 77 loop.Run(); | 77 loop.Run(); |
| 78 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; | 78 LOG(INFO) << " video seeked to: " << video_seeked_to_ms << "ms"; |
| 79 } | 79 } |
| 80 | 80 |
| 81 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); | 81 demuxer->Stop(base::Bind(&MessageLoop::Quit, base::Unretained(&loop))); |
| 82 loop.Run(); | 82 loop.Run(); |
| 83 | 83 |
| 84 return 0; | 84 return 0; |
| 85 } | 85 } |
| OLD | NEW |