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 #ifndef MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ | 5 #ifndef MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
6 #define MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ | 6 #define MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
11 #include "media/base/demuxer_stream.h" | 11 #include "media/base/demuxer_stream.h" |
12 #include "media/base/video_decoder_config.h" | 12 #include "media/base/video_decoder_config.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class MessageLoopProxy; | 15 class SingleThreadTaskRunner; |
16 } // namespace base | 16 } // namespace base |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 class FakeDemuxerStream : public DemuxerStream { | 20 class FakeDemuxerStream : public DemuxerStream { |
21 public: | 21 public: |
22 // Constructs an object that outputs |num_configs| different configs in | 22 // Constructs an object that outputs |num_configs| different configs in |
23 // sequence with |num_frames_in_one_config| buffers for each config. The | 23 // sequence with |num_frames_in_one_config| buffers for each config. The |
24 // output buffers are encrypted if |is_encrypted| is true. | 24 // output buffers are encrypted if |is_encrypted| is true. |
25 FakeDemuxerStream(int num_configs, | 25 FakeDemuxerStream(int num_configs, |
(...skipping 23 matching lines...) Expand all Loading... |
49 void SatisfyRead(); | 49 void SatisfyRead(); |
50 | 50 |
51 // Satisfies the pending read (if any) with kAborted and NULL. This call | 51 // Satisfies the pending read (if any) with kAborted and NULL. This call |
52 // always clears |hold_next_read_|. | 52 // always clears |hold_next_read_|. |
53 void Reset(); | 53 void Reset(); |
54 | 54 |
55 private: | 55 private: |
56 void UpdateVideoDecoderConfig(); | 56 void UpdateVideoDecoderConfig(); |
57 void DoRead(); | 57 void DoRead(); |
58 | 58 |
59 scoped_refptr<base::MessageLoopProxy> message_loop_; | 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
60 | 60 |
61 int num_configs_left_; | 61 int num_configs_left_; |
62 int num_buffers_in_one_config_; | 62 int num_buffers_in_one_config_; |
63 bool is_encrypted_; | 63 bool is_encrypted_; |
64 | 64 |
65 // Number of frames left with the current decoder config. | 65 // Number of frames left with the current decoder config. |
66 int num_buffers_left_in_current_config_; | 66 int num_buffers_left_in_current_config_; |
67 | 67 |
68 int num_buffers_returned_; | 68 int num_buffers_returned_; |
69 | 69 |
70 base::TimeDelta current_timestamp_; | 70 base::TimeDelta current_timestamp_; |
71 base::TimeDelta duration_; | 71 base::TimeDelta duration_; |
72 | 72 |
73 gfx::Size next_coded_size_; | 73 gfx::Size next_coded_size_; |
74 VideoDecoderConfig video_decoder_config_; | 74 VideoDecoderConfig video_decoder_config_; |
75 | 75 |
76 ReadCB read_cb_; | 76 ReadCB read_cb_; |
77 | 77 |
78 int next_read_num_; | 78 int next_read_num_; |
79 // Zero-based number indicating which read operation should be held. -1 means | 79 // Zero-based number indicating which read operation should be held. -1 means |
80 // no read shall be held. | 80 // no read shall be held. |
81 int read_to_hold_; | 81 int read_to_hold_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); | 83 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace media | 86 } // namespace media |
87 | 87 |
88 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ | 88 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
OLD | NEW |