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" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/thread_task_runner_handle.h" | |
13 #include "media/base/bind_to_current_loop.h" | 12 #include "media/base/bind_to_current_loop.h" |
14 #include "media/base/decoder_buffer.h" | 13 #include "media/base/decoder_buffer.h" |
15 #include "media/base/test_helpers.h" | 14 #include "media/base/test_helpers.h" |
16 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
17 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
18 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
19 | 18 |
20 namespace media { | 19 namespace media { |
21 | 20 |
22 const int kStartTimestampMs = 0; | 21 const int kStartTimestampMs = 0; |
23 const int kDurationMs = 30; | 22 const int kDurationMs = 30; |
24 const int kStartWidth = 320; | 23 const int kStartWidth = 320; |
25 const int kStartHeight = 240; | 24 const int kStartHeight = 240; |
26 const int kWidthDelta = 4; | 25 const int kWidthDelta = 4; |
27 const int kHeightDelta = 3; | 26 const int kHeightDelta = 3; |
28 const uint8 kKeyId[] = { 0x00, 0x01, 0x02, 0x03 }; | 27 const uint8 kKeyId[] = { 0x00, 0x01, 0x02, 0x03 }; |
29 const uint8 kIv[] = { | 28 const uint8 kIv[] = { |
30 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, | 29 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, |
31 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 30 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
32 }; | 31 }; |
33 | 32 |
34 FakeDemuxerStream::FakeDemuxerStream(int num_configs, | 33 FakeDemuxerStream::FakeDemuxerStream(int num_configs, |
35 int num_buffers_in_one_config, | 34 int num_buffers_in_one_config, |
36 bool is_encrypted) | 35 bool is_encrypted) |
37 : task_runner_(base::ThreadTaskRunnerHandle::Get()), | 36 : task_runner_(base::MessageLoopProxy::current()), |
38 num_configs_(num_configs), | 37 num_configs_(num_configs), |
39 num_buffers_in_one_config_(num_buffers_in_one_config), | 38 num_buffers_in_one_config_(num_buffers_in_one_config), |
40 config_changes_(num_configs > 1), | 39 config_changes_(num_configs > 1), |
41 is_encrypted_(is_encrypted), | 40 is_encrypted_(is_encrypted), |
42 read_to_hold_(-1) { | 41 read_to_hold_(-1) { |
43 DCHECK_GT(num_configs, 0); | 42 DCHECK_GT(num_configs, 0); |
44 DCHECK_GT(num_buffers_in_one_config, 0); | 43 DCHECK_GT(num_buffers_in_one_config, 0); |
45 Initialize(); | 44 Initialize(); |
46 UpdateVideoDecoderConfig(); | 45 UpdateVideoDecoderConfig(); |
47 } | 46 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 186 |
188 num_buffers_left_in_current_config_--; | 187 num_buffers_left_in_current_config_--; |
189 if (num_buffers_left_in_current_config_ == 0) | 188 if (num_buffers_left_in_current_config_ == 0) |
190 num_configs_left_--; | 189 num_configs_left_--; |
191 | 190 |
192 num_buffers_returned_++; | 191 num_buffers_returned_++; |
193 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); | 192 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); |
194 } | 193 } |
195 | 194 |
196 } // namespace media | 195 } // namespace media |
OLD | NEW |