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 16 matching lines...) Expand all Loading... | |
27 DemuxerHostImpl() {} | 27 DemuxerHostImpl() {} |
28 virtual ~DemuxerHostImpl() {} | 28 virtual ~DemuxerHostImpl() {} |
29 | 29 |
30 // DataSourceHost implementation. | 30 // DataSourceHost implementation. |
31 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {} | 31 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE {} |
32 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {} | 32 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE {} |
33 virtual void AddBufferedTimeRange(base::TimeDelta start, | 33 virtual void AddBufferedTimeRange(base::TimeDelta start, |
34 base::TimeDelta end) OVERRIDE {} | 34 base::TimeDelta end) OVERRIDE {} |
35 | 35 |
36 // DemuxerHost implementation. | 36 // DemuxerHost implementation. |
37 virtual void SetDuration(base::TimeDelta duration) OVERRIDE {} | 37 virtual void set_duration(base::TimeDelta duration) OVERRIDE {} |
scherkus (not reviewing)
2013/06/20 21:26:59
this shouldn't be part of your change
| |
38 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} | 38 virtual void OnDemuxerError(media::PipelineStatus error) OVERRIDE {} |
39 | 39 |
40 private: | 40 private: |
41 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl); | 41 DISALLOW_COPY_AND_ASSIGN(DemuxerHostImpl); |
42 }; | 42 }; |
43 | 43 |
44 void QuitLoopWithStatus(base::MessageLoop* message_loop, | 44 void QuitLoopWithStatus(base::MessageLoop* message_loop, |
45 media::PipelineStatus status) { | 45 media::PipelineStatus status) { |
46 CHECK_EQ(status, media::PIPELINE_OK); | 46 CHECK_EQ(status, media::PIPELINE_OK); |
47 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 47 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 } | 137 } |
138 | 138 |
139 void StreamReader::OnReadDone( | 139 void StreamReader::OnReadDone( |
140 base::MessageLoop* message_loop, | 140 base::MessageLoop* message_loop, |
141 bool* end_of_stream, | 141 bool* end_of_stream, |
142 base::TimeDelta* timestamp, | 142 base::TimeDelta* timestamp, |
143 media::DemuxerStream::Status status, | 143 media::DemuxerStream::Status status, |
144 const scoped_refptr<media::DecoderBuffer>& buffer) { | 144 const scoped_refptr<media::DecoderBuffer>& buffer) { |
145 CHECK_EQ(status, media::DemuxerStream::kOk); | 145 CHECK_EQ(status, media::DemuxerStream::kOk); |
146 CHECK(buffer.get()); | 146 CHECK(buffer.get()); |
147 *end_of_stream = buffer->IsEndOfStream(); | 147 *end_of_stream = buffer->is_end_of_stream(); |
148 *timestamp = *end_of_stream ? media::kNoTimestamp() : buffer->GetTimestamp(); | 148 *timestamp = *end_of_stream ? media::kNoTimestamp() : buffer->get_timestamp(); |
149 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 149 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
150 } | 150 } |
151 | 151 |
152 int StreamReader::GetNextStreamIndexToRead() { | 152 int StreamReader::GetNextStreamIndexToRead() { |
153 int index = -1; | 153 int index = -1; |
154 for (int i = 0; i < number_of_streams(); ++i) { | 154 for (int i = 0; i < number_of_streams(); ++i) { |
155 // Ignore streams at EOS. | 155 // Ignore streams at EOS. |
156 if (end_of_stream_[i]) | 156 if (end_of_stream_[i]) |
157 continue; | 157 continue; |
158 | 158 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl; | 228 std::cout << ", " << stream_reader.counts()[i] << " packets" << std::endl; |
229 } | 229 } |
230 | 230 |
231 // Teardown. | 231 // Teardown. |
232 demuxer.Stop(base::Bind( | 232 demuxer.Stop(base::Bind( |
233 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK)); | 233 &QuitLoopWithStatus, &message_loop, media::PIPELINE_OK)); |
234 message_loop.Run(); | 234 message_loop.Run(); |
235 | 235 |
236 return 0; | 236 return 0; |
237 } | 237 } |
OLD | NEW |