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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 bool is_encrypted); | 28 bool is_encrypted); |
29 virtual ~FakeDemuxerStream(); | 29 virtual ~FakeDemuxerStream(); |
30 | 30 |
31 // DemuxerStream implementation. | 31 // DemuxerStream implementation. |
32 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 32 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
33 virtual const AudioDecoderConfig& audio_decoder_config() OVERRIDE; | 33 virtual const AudioDecoderConfig& audio_decoder_config() OVERRIDE; |
34 virtual const VideoDecoderConfig& video_decoder_config() OVERRIDE; | 34 virtual const VideoDecoderConfig& video_decoder_config() OVERRIDE; |
35 virtual Type type() OVERRIDE; | 35 virtual Type type() OVERRIDE; |
36 virtual void EnableBitstreamConverter() OVERRIDE; | 36 virtual void EnableBitstreamConverter() OVERRIDE; |
37 | 37 |
| 38 int num_buffers_returned() const { return num_buffers_returned_; } |
| 39 |
38 // Upon the next read, holds the read callback until SatisfyRead() or Reset() | 40 // Upon the next read, holds the read callback until SatisfyRead() or Reset() |
39 // is called. | 41 // is called. |
40 void HoldNextRead(); | 42 void HoldNextRead(); |
41 | 43 |
| 44 // Upon the next config change read, holds the read callback until |
| 45 // SatisfyRead() or Reset() is called. If there is no config change any more, |
| 46 // no read will be held. |
| 47 void HoldNextConfigChangeRead(); |
| 48 |
42 // Satisfies the pending read with the next scheduled status and buffer. | 49 // Satisfies the pending read with the next scheduled status and buffer. |
43 void SatisfyRead(); | 50 void SatisfyRead(); |
44 | 51 |
45 // Satisfies the pending read (if any) with kAborted and NULL. This call | 52 // Satisfies the pending read (if any) with kAborted and NULL. This call |
46 // always clears |hold_next_read_|. | 53 // always clears |hold_next_read_|. |
47 void Reset(); | 54 void Reset(); |
48 | 55 |
49 private: | 56 private: |
50 void UpdateVideoDecoderConfig(); | 57 void UpdateVideoDecoderConfig(); |
51 void DoRead(); | 58 void DoRead(); |
52 | 59 |
53 scoped_refptr<base::MessageLoopProxy> message_loop_; | 60 scoped_refptr<base::MessageLoopProxy> message_loop_; |
54 | 61 |
55 int num_configs_left_; | 62 int num_configs_left_; |
56 int num_buffers_in_one_config_; | 63 int num_buffers_in_one_config_; |
57 bool is_encrypted_; | 64 bool is_encrypted_; |
58 | 65 |
59 // Number of frames left with the current decoder config. | 66 // Number of frames left with the current decoder config. |
60 int num_buffers_left_in_current_config_; | 67 int num_buffers_left_in_current_config_; |
61 | 68 |
| 69 int num_buffers_returned_; |
| 70 |
62 base::TimeDelta current_timestamp_; | 71 base::TimeDelta current_timestamp_; |
63 base::TimeDelta duration_; | 72 base::TimeDelta duration_; |
64 | 73 |
65 AudioDecoderConfig audio_decoder_config_; | 74 AudioDecoderConfig audio_decoder_config_; |
66 | 75 |
67 gfx::Size next_coded_size_; | 76 gfx::Size next_coded_size_; |
68 VideoDecoderConfig video_decoder_config_; | 77 VideoDecoderConfig video_decoder_config_; |
69 | 78 |
70 ReadCB read_cb_; | 79 ReadCB read_cb_; |
71 bool hold_next_read_; | 80 |
| 81 int next_read_num_; |
| 82 // Zero-based number indicating which read operation should be held. -1 means |
| 83 // no read shall be held. |
| 84 int read_to_hold_; |
72 | 85 |
73 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); | 86 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); |
74 }; | 87 }; |
75 | 88 |
76 } // namespace media | 89 } // namespace media |
77 | 90 |
78 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ | 91 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
OLD | NEW |