Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: media/filters/decrypting_audio_decoder.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // Updates audio configs from |demuxer_stream_| and resets 102 // Updates audio configs from |demuxer_stream_| and resets
103 // |output_timestamp_base_| and |total_samples_decoded_|. 103 // |output_timestamp_base_| and |total_samples_decoded_|.
104 void UpdateDecoderConfig(); 104 void UpdateDecoderConfig();
105 105
106 // Sets timestamp and duration for |queued_audio_frames_| to make sure the 106 // Sets timestamp and duration for |queued_audio_frames_| to make sure the
107 // renderer always receives continuous frames without gaps and overlaps. 107 // renderer always receives continuous frames without gaps and overlaps.
108 void EnqueueFrames(const Decryptor::AudioBuffers& frames); 108 void EnqueueFrames(const Decryptor::AudioBuffers& frames);
109 109
110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
111 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_;
112 base::WeakPtr<DecryptingAudioDecoder> weak_this_;
113 111
114 State state_; 112 State state_;
115 113
116 PipelineStatusCB init_cb_; 114 PipelineStatusCB init_cb_;
117 StatisticsCB statistics_cb_; 115 StatisticsCB statistics_cb_;
118 ReadCB read_cb_; 116 ReadCB read_cb_;
119 base::Closure reset_cb_; 117 base::Closure reset_cb_;
120 base::Closure stop_cb_; 118 base::Closure stop_cb_;
121 119
122 // Pointer to the demuxer stream that will feed us compressed buffers. 120 // Pointer to the demuxer stream that will feed us compressed buffers.
(...skipping 16 matching lines...) Expand all
139 137
140 Decryptor::AudioBuffers queued_audio_frames_; 138 Decryptor::AudioBuffers queued_audio_frames_;
141 139
142 // Decoded audio format. 140 // Decoded audio format.
143 int bits_per_channel_; 141 int bits_per_channel_;
144 ChannelLayout channel_layout_; 142 ChannelLayout channel_layout_;
145 int samples_per_second_; 143 int samples_per_second_;
146 144
147 scoped_ptr<AudioTimestampHelper> timestamp_helper_; 145 scoped_ptr<AudioTimestampHelper> timestamp_helper_;
148 146
147 // NOTE: These must always be last so they're invalidated before other member
148 // variables might be accessed.
149 base::WeakPtr<DecryptingAudioDecoder> weak_this_;
150 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_;
151
149 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); 152 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder);
150 }; 153 };
151 154
152 } // namespace media 155 } // namespace media
153 156
154 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 157 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698