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