| 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 // demuxer_bench is a standalone benchmarking tool for FFmpegDemuxer. It | 5 // demuxer_bench is a standalone benchmarking tool for FFmpegDemuxer. It |
| 6 // simulates the reading requirements for playback by reading from the stream | 6 // simulates the reading requirements for playback by reading from the stream |
| 7 // that has the earliest timestamp. | 7 // that has the earliest timestamp. |
| 8 | 8 |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 CommandLine::Init(argc, argv); | 163 CommandLine::Init(argc, argv); |
| 164 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 164 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 165 | 165 |
| 166 if (cmd_line->GetArgs().empty()) { | 166 if (cmd_line->GetArgs().empty()) { |
| 167 std::cerr << "Usage: " << argv[0] << " [file]" << std::endl; | 167 std::cerr << "Usage: " << argv[0] << " [file]" << std::endl; |
| 168 return 1; | 168 return 1; |
| 169 } | 169 } |
| 170 | 170 |
| 171 MessageLoop message_loop; | 171 MessageLoop message_loop; |
| 172 DemuxerHostImpl demuxer_host; | 172 DemuxerHostImpl demuxer_host; |
| 173 FilePath file_path(cmd_line->GetArgs()[0]); | 173 base::FilePath file_path(cmd_line->GetArgs()[0]); |
| 174 | 174 |
| 175 // Setup. | 175 // Setup. |
| 176 scoped_refptr<media::FileDataSource> data_source = | 176 scoped_refptr<media::FileDataSource> data_source = |
| 177 new media::FileDataSource(); | 177 new media::FileDataSource(); |
| 178 CHECK(data_source->Initialize(file_path)); | 178 CHECK(data_source->Initialize(file_path)); |
| 179 | 179 |
| 180 scoped_refptr<media::FFmpegDemuxer> demuxer = | 180 scoped_refptr<media::FFmpegDemuxer> demuxer = |
| 181 new media::FFmpegDemuxer(message_loop.message_loop_proxy(), data_source); | 181 new media::FFmpegDemuxer(message_loop.message_loop_proxy(), data_source); |
| 182 | 182 |
| 183 demuxer->Initialize(&demuxer_host, base::Bind( | 183 demuxer->Initialize(&demuxer_host, base::Bind( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 210 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl; | 210 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl; |
| 211 } | 211 } |
| 212 | 212 |
| 213 // Teardown. | 213 // Teardown. |
| 214 demuxer->Stop(base::Bind( | 214 demuxer->Stop(base::Bind( |
| 215 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK)); | 215 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK)); |
| 216 message_loop.Run(); | 216 message_loop.Run(); |
| 217 | 217 |
| 218 return 0; | 218 return 0; |
| 219 } | 219 } |
| OLD | NEW |