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