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/base/fake_demuxer_stream.h" | 5 #include "media/base/fake_demuxer_stream.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "media/base/bind_to_current_loop.h" | 15 #include "media/base/bind_to_current_loop.h" |
16 #include "media/base/decoder_buffer.h" | 16 #include "media/base/decoder_buffer.h" |
| 17 #include "media/base/encryption_scheme.h" |
17 #include "media/base/media_util.h" | 18 #include "media/base/media_util.h" |
18 #include "media/base/test_helpers.h" | 19 #include "media/base/test_helpers.h" |
19 #include "media/base/timestamp_constants.h" | 20 #include "media/base/timestamp_constants.h" |
20 #include "media/base/video_frame.h" | 21 #include "media/base/video_frame.h" |
21 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/gfx/geometry/size.h" | 23 #include "ui/gfx/geometry/size.h" |
23 | 24 |
24 namespace media { | 25 namespace media { |
25 | 26 |
26 const int kStartTimestampMs = 0; | 27 const int kStartTimestampMs = 0; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); | 140 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
140 } | 141 } |
141 | 142 |
142 void FakeDemuxerStream::SeekToStart() { | 143 void FakeDemuxerStream::SeekToStart() { |
143 Reset(); | 144 Reset(); |
144 Initialize(); | 145 Initialize(); |
145 } | 146 } |
146 | 147 |
147 void FakeDemuxerStream::UpdateVideoDecoderConfig() { | 148 void FakeDemuxerStream::UpdateVideoDecoderConfig() { |
148 const gfx::Rect kVisibleRect(kStartWidth, kStartHeight); | 149 const gfx::Rect kVisibleRect(kStartWidth, kStartHeight); |
149 video_decoder_config_.Initialize(kCodecVP8, VIDEO_CODEC_PROFILE_UNKNOWN, | 150 video_decoder_config_.Initialize( |
150 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED, | 151 kCodecVP8, VIDEO_CODEC_PROFILE_UNKNOWN, PIXEL_FORMAT_YV12, |
151 next_coded_size_, kVisibleRect, | 152 COLOR_SPACE_UNSPECIFIED, next_coded_size_, kVisibleRect, next_coded_size_, |
152 next_coded_size_, EmptyExtraData(), | 153 EmptyExtraData(), EncryptionScheme(is_encrypted_)); |
153 is_encrypted_); | |
154 next_coded_size_.Enlarge(kWidthDelta, kHeightDelta); | 154 next_coded_size_.Enlarge(kWidthDelta, kHeightDelta); |
155 } | 155 } |
156 | 156 |
157 void FakeDemuxerStream::DoRead() { | 157 void FakeDemuxerStream::DoRead() { |
158 DCHECK(task_runner_->BelongsToCurrentThread()); | 158 DCHECK(task_runner_->BelongsToCurrentThread()); |
159 DCHECK(!read_cb_.is_null()); | 159 DCHECK(!read_cb_.is_null()); |
160 | 160 |
161 next_read_num_++; | 161 next_read_num_++; |
162 | 162 |
163 if (num_buffers_left_in_current_config_ == 0) { | 163 if (num_buffers_left_in_current_config_ == 0) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 FakeDemuxerStreamProvider::~FakeDemuxerStreamProvider() { | 210 FakeDemuxerStreamProvider::~FakeDemuxerStreamProvider() { |
211 } | 211 } |
212 | 212 |
213 DemuxerStream* FakeDemuxerStreamProvider::GetStream(DemuxerStream::Type type) { | 213 DemuxerStream* FakeDemuxerStreamProvider::GetStream(DemuxerStream::Type type) { |
214 if (type == DemuxerStream::Type::AUDIO) | 214 if (type == DemuxerStream::Type::AUDIO) |
215 return nullptr; | 215 return nullptr; |
216 return &fake_video_stream_; | 216 return &fake_video_stream_; |
217 }; | 217 }; |
218 | 218 |
219 } // namespace media | 219 } // namespace media |
OLD | NEW |