| 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/memory/ptr_util.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 18 #include "media/base/bind_to_current_loop.h" | 19 #include "media/base/bind_to_current_loop.h" |
| 19 #include "media/base/decoder_buffer.h" | 20 #include "media/base/decoder_buffer.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" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 UpdateVideoDecoderConfig(); | 175 UpdateVideoDecoderConfig(); |
| 175 base::ResetAndReturn(&read_cb_).Run(kConfigChanged, NULL); | 176 base::ResetAndReturn(&read_cb_).Run(kConfigChanged, NULL); |
| 176 return; | 177 return; |
| 177 } | 178 } |
| 178 | 179 |
| 179 scoped_refptr<DecoderBuffer> buffer = CreateFakeVideoBufferForTest( | 180 scoped_refptr<DecoderBuffer> buffer = CreateFakeVideoBufferForTest( |
| 180 video_decoder_config_, current_timestamp_, duration_); | 181 video_decoder_config_, current_timestamp_, duration_); |
| 181 | 182 |
| 182 // TODO(xhwang): Output out-of-order buffers if needed. | 183 // TODO(xhwang): Output out-of-order buffers if needed. |
| 183 if (is_encrypted_) { | 184 if (is_encrypted_) { |
| 184 buffer->set_decrypt_config(scoped_ptr<DecryptConfig>( | 185 buffer->set_decrypt_config(base::WrapUnique( |
| 185 new DecryptConfig(std::string(kKeyId, kKeyId + arraysize(kKeyId)), | 186 new DecryptConfig(std::string(kKeyId, kKeyId + arraysize(kKeyId)), |
| 186 std::string(kIv, kIv + arraysize(kIv)), | 187 std::string(kIv, kIv + arraysize(kIv)), |
| 187 std::vector<SubsampleEntry>()))); | 188 std::vector<SubsampleEntry>()))); |
| 188 } | 189 } |
| 189 buffer->set_timestamp(current_timestamp_); | 190 buffer->set_timestamp(current_timestamp_); |
| 190 buffer->set_duration(duration_); | 191 buffer->set_duration(duration_); |
| 191 buffer->set_splice_timestamp(splice_timestamp_); | 192 buffer->set_splice_timestamp(splice_timestamp_); |
| 192 current_timestamp_ += duration_; | 193 current_timestamp_ += duration_; |
| 193 | 194 |
| 194 num_buffers_left_in_current_config_--; | 195 num_buffers_left_in_current_config_--; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 211 FakeDemuxerStreamProvider::~FakeDemuxerStreamProvider() { | 212 FakeDemuxerStreamProvider::~FakeDemuxerStreamProvider() { |
| 212 } | 213 } |
| 213 | 214 |
| 214 DemuxerStream* FakeDemuxerStreamProvider::GetStream(DemuxerStream::Type type) { | 215 DemuxerStream* FakeDemuxerStreamProvider::GetStream(DemuxerStream::Type type) { |
| 215 if (type == DemuxerStream::Type::AUDIO) | 216 if (type == DemuxerStream::Type::AUDIO) |
| 216 return nullptr; | 217 return nullptr; |
| 217 return &fake_video_stream_; | 218 return &fake_video_stream_; |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 } // namespace media | 221 } // namespace media |
| OLD | NEW |