OLD | NEW |
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // call. | 160 // call. |
161 int buffer_fill_end_; | 161 int buffer_fill_end_; |
162 | 162 |
163 // A counter used to label EncodedAudioFrames. | 163 // A counter used to label EncodedAudioFrames. |
164 uint32 frame_id_; | 164 uint32 frame_id_; |
165 | 165 |
166 // For audio, rtp_timestamp is computed as the sum of the audio samples seen | 166 // For audio, rtp_timestamp is computed as the sum of the audio samples seen |
167 // so far. | 167 // so far. |
168 uint32 rtp_timestamp_; | 168 uint32 rtp_timestamp_; |
169 | 169 |
| 170 // NOTE: Weak pointers must be invalidated before all other member variables. |
170 base::WeakPtrFactory<ImplBase> weak_factory_; | 171 base::WeakPtrFactory<ImplBase> weak_factory_; |
171 | 172 |
172 private: | |
173 DISALLOW_COPY_AND_ASSIGN(ImplBase); | 173 DISALLOW_COPY_AND_ASSIGN(ImplBase); |
174 }; | 174 }; |
175 | 175 |
176 class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase { | 176 class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase { |
177 public: | 177 public: |
178 OpusImpl(const scoped_refptr<CastEnvironment>& cast_environment, | 178 OpusImpl(const scoped_refptr<CastEnvironment>& cast_environment, |
179 int num_channels, | 179 int num_channels, |
180 int sampling_rate, | 180 int sampling_rate, |
181 int bitrate, | 181 int bitrate, |
182 const FrameEncodedCallback& callback) | 182 const FrameEncodedCallback& callback) |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 cast_environment_->PostTask(CastEnvironment::AUDIO_ENCODER, | 353 cast_environment_->PostTask(CastEnvironment::AUDIO_ENCODER, |
354 FROM_HERE, | 354 FROM_HERE, |
355 base::Bind(&AudioEncoder::ImplBase::EncodeAudio, | 355 base::Bind(&AudioEncoder::ImplBase::EncodeAudio, |
356 impl_, | 356 impl_, |
357 base::Passed(&audio_bus), | 357 base::Passed(&audio_bus), |
358 recorded_time)); | 358 recorded_time)); |
359 } | 359 } |
360 | 360 |
361 } // namespace cast | 361 } // namespace cast |
362 } // namespace media | 362 } // namespace media |
OLD | NEW |