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

Side by Side Diff: media/cast/audio_sender/audio_encoder.cc

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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/cast/audio_sender/audio_encoder.h" 5 #include "media/cast/audio_sender/audio_encoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // call. 164 // call.
165 int buffer_fill_end_; 165 int buffer_fill_end_;
166 166
167 // A counter used to label EncodedAudioFrames. 167 // A counter used to label EncodedAudioFrames.
168 uint32 frame_id_; 168 uint32 frame_id_;
169 169
170 // For audio, rtp_timestamp is computed as the sum of the audio samples seen 170 // For audio, rtp_timestamp is computed as the sum of the audio samples seen
171 // so far. 171 // so far.
172 uint32 rtp_timestamp_; 172 uint32 rtp_timestamp_;
173 173
174 // NOTE: This must always be last so it's invalidated before other member
175 // variables might be accessed.
174 base::WeakPtrFactory<ImplBase> weak_factory_; 176 base::WeakPtrFactory<ImplBase> weak_factory_;
175 177
176 private:
Ami GONE FROM CHROMIUM 2014/03/10 22:02:08 PRIVATE!!!
DaleCurtis 2014/03/10 22:10:00 Look up; it was extra private. :)
177 DISALLOW_COPY_AND_ASSIGN(ImplBase); 178 DISALLOW_COPY_AND_ASSIGN(ImplBase);
178 }; 179 };
179 180
180 class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase { 181 class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase {
181 public: 182 public:
182 OpusImpl(CastEnvironment* cast_environment, 183 OpusImpl(CastEnvironment* cast_environment,
183 int num_channels, 184 int num_channels,
184 int sampling_rate, 185 int sampling_rate,
185 int bitrate, 186 int bitrate,
186 const FrameEncodedCallback& callback) 187 const FrameEncodedCallback& callback)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 368
368 void AudioEncoder::EncodeAudio(const AudioBus* audio_bus, 369 void AudioEncoder::EncodeAudio(const AudioBus* audio_bus,
369 const base::TimeTicks& recorded_time, 370 const base::TimeTicks& recorded_time,
370 const base::Closure& done_callback) { 371 const base::Closure& done_callback) {
371 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::AUDIO_ENCODER)); 372 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::AUDIO_ENCODER));
372 impl_->EncodeAudio(audio_bus, recorded_time, done_callback); 373 impl_->EncodeAudio(audio_bus, recorded_time, done_callback);
373 } 374 }
374 375
375 } // namespace cast 376 } // namespace cast
376 } // namespace media 377 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698