OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DECRYPTING_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ |
6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ | 6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Updates audio configs from |demuxer_stream_| and resets | 93 // Updates audio configs from |demuxer_stream_| and resets |
94 // |output_timestamp_base_| and |total_samples_decoded_|. | 94 // |output_timestamp_base_| and |total_samples_decoded_|. |
95 void UpdateDecoderConfig(); | 95 void UpdateDecoderConfig(); |
96 | 96 |
97 // Sets timestamp and duration for |queued_audio_frames_| to make sure the | 97 // Sets timestamp and duration for |queued_audio_frames_| to make sure the |
98 // renderer always receives continuous frames without gaps and overlaps. | 98 // renderer always receives continuous frames without gaps and overlaps. |
99 void EnqueueFrames(const Decryptor::AudioBuffers& frames); | 99 void EnqueueFrames(const Decryptor::AudioBuffers& frames); |
100 | 100 |
101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
102 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; | |
103 base::WeakPtr<DecryptingAudioDecoder> weak_this_; | |
104 | 102 |
105 State state_; | 103 State state_; |
106 | 104 |
107 PipelineStatusCB init_cb_; | 105 PipelineStatusCB init_cb_; |
108 DecodeCB decode_cb_; | 106 DecodeCB decode_cb_; |
109 base::Closure reset_cb_; | 107 base::Closure reset_cb_; |
110 base::Closure stop_cb_; | 108 base::Closure stop_cb_; |
111 | 109 |
112 // The current decoder configuration. | 110 // The current decoder configuration. |
113 AudioDecoderConfig config_; | 111 AudioDecoderConfig config_; |
(...skipping 15 matching lines...) Expand all Loading... |
129 | 127 |
130 Decryptor::AudioBuffers queued_audio_frames_; | 128 Decryptor::AudioBuffers queued_audio_frames_; |
131 | 129 |
132 // Decoded audio format. | 130 // Decoded audio format. |
133 int bits_per_channel_; | 131 int bits_per_channel_; |
134 ChannelLayout channel_layout_; | 132 ChannelLayout channel_layout_; |
135 int samples_per_second_; | 133 int samples_per_second_; |
136 | 134 |
137 scoped_ptr<AudioTimestampHelper> timestamp_helper_; | 135 scoped_ptr<AudioTimestampHelper> timestamp_helper_; |
138 | 136 |
| 137 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 138 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; |
| 139 base::WeakPtr<DecryptingAudioDecoder> weak_this_; |
| 140 |
139 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); | 141 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); |
140 }; | 142 }; |
141 | 143 |
142 } // namespace media | 144 } // namespace media |
143 | 145 |
144 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ | 146 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ |
OLD | NEW |