OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "media/filters/fake_demuxer_stream.h" | 5 #include "media/filters/fake_demuxer_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 static const char kFakeBufferHeader[] = "Fake Buffer"; | 27 static const char kFakeBufferHeader[] = "Fake Buffer"; |
28 | 28 |
29 FakeDemuxerStream::FakeDemuxerStream(int num_configs, | 29 FakeDemuxerStream::FakeDemuxerStream(int num_configs, |
30 int num_buffers_in_one_config, | 30 int num_buffers_in_one_config, |
31 bool is_encrypted) | 31 bool is_encrypted) |
32 : message_loop_(base::MessageLoopProxy::current()), | 32 : message_loop_(base::MessageLoopProxy::current()), |
33 num_configs_left_(num_configs), | 33 num_configs_left_(num_configs), |
34 num_buffers_in_one_config_(num_buffers_in_one_config), | 34 num_buffers_in_one_config_(num_buffers_in_one_config), |
35 is_encrypted_(is_encrypted), | 35 is_encrypted_(is_encrypted), |
36 num_buffers_left_in_current_config_(num_buffers_in_one_config), | 36 num_buffers_left_in_current_config_(num_buffers_in_one_config), |
| 37 num_buffers_returned_(0), |
37 current_timestamp_(base::TimeDelta::FromMilliseconds(kStartTimestampMs)), | 38 current_timestamp_(base::TimeDelta::FromMilliseconds(kStartTimestampMs)), |
38 duration_(base::TimeDelta::FromMilliseconds(kDurationMs)), | 39 duration_(base::TimeDelta::FromMilliseconds(kDurationMs)), |
39 next_coded_size_(kStartWidth, kStartHeight), | 40 next_coded_size_(kStartWidth, kStartHeight), |
40 hold_next_read_(false) { | 41 hold_next_read_(false) { |
41 DCHECK_GT(num_configs_left_, 0); | 42 DCHECK_GT(num_configs_left_, 0); |
42 DCHECK_GT(num_buffers_in_one_config_, 0); | 43 DCHECK_GT(num_buffers_in_one_config_, 0); |
43 UpdateVideoDecoderConfig(); | 44 UpdateVideoDecoderConfig(); |
44 } | 45 } |
45 | 46 |
46 FakeDemuxerStream::~FakeDemuxerStream() {} | 47 FakeDemuxerStream::~FakeDemuxerStream() {} |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // TODO(xhwang): Output out-of-order buffers if needed. | 138 // TODO(xhwang): Output out-of-order buffers if needed. |
138 buffer->SetTimestamp(current_timestamp_); | 139 buffer->SetTimestamp(current_timestamp_); |
139 buffer->SetDuration(duration_); | 140 buffer->SetDuration(duration_); |
140 current_timestamp_ += duration_; | 141 current_timestamp_ += duration_; |
141 | 142 |
142 num_buffers_left_in_current_config_--; | 143 num_buffers_left_in_current_config_--; |
143 if (num_buffers_left_in_current_config_ == 0) | 144 if (num_buffers_left_in_current_config_ == 0) |
144 num_configs_left_--; | 145 num_configs_left_--; |
145 | 146 |
146 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); | 147 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); |
| 148 num_buffers_returned_++; |
147 } | 149 } |
148 | 150 |
149 } // namespace media | 151 } // namespace media |
OLD | NEW |