| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sender/audio_sender.h" | 5 #include "media/cast/sender/audio_sender.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "media/cast/net/cast_transport_config.h" | 10 #include "media/cast/net/cast_transport_config.h" |
| 11 #include "media/cast/sender/audio_encoder.h" | 11 #include "media/cast/sender/audio_encoder.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 namespace cast { | 14 namespace cast { |
| 15 | 15 |
| 16 AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, | 16 AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, |
| 17 const AudioSenderConfig& audio_config, | 17 const AudioSenderConfig& audio_config, |
| 18 const StatusChangeCallback& status_change_cb, | 18 const StatusChangeCallback& status_change_cb, |
| 19 CastTransportSender* const transport_sender) | 19 CastTransportSender* const transport_sender) |
| 20 : FrameSender(cast_environment, | 20 : FrameSender(cast_environment, |
| 21 true, | 21 true, |
| 22 transport_sender, | 22 transport_sender, |
| 23 audio_config.frequency, | 23 audio_config.frequency, |
| 24 audio_config.ssrc, | 24 audio_config.ssrc, |
| 25 0, // |max_frame_rate_| is set after encoder initialization. | 25 0, // |max_frame_rate_| is set after encoder initialization. |
| 26 audio_config.min_playout_delay, | 26 audio_config.min_playout_delay, |
| 27 audio_config.max_playout_delay, | 27 audio_config.max_playout_delay, |
| 28 audio_config.animated_playout_delay, |
| 28 NewFixedCongestionControl(audio_config.bitrate)), | 29 NewFixedCongestionControl(audio_config.bitrate)), |
| 29 samples_in_encoder_(0), | 30 samples_in_encoder_(0), |
| 30 weak_factory_(this) { | 31 weak_factory_(this) { |
| 31 if (!audio_config.use_external_encoder) { | 32 if (!audio_config.use_external_encoder) { |
| 32 audio_encoder_.reset( | 33 audio_encoder_.reset( |
| 33 new AudioEncoder(cast_environment, | 34 new AudioEncoder(cast_environment, |
| 34 audio_config.channels, | 35 audio_config.channels, |
| 35 audio_config.frequency, | 36 audio_config.frequency, |
| 36 audio_config.bitrate, | 37 audio_config.bitrate, |
| 37 audio_config.codec, | 38 audio_config.codec, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 112 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 112 | 113 |
| 113 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; | 114 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; |
| 114 DCHECK_GE(samples_in_encoder_, 0); | 115 DCHECK_GE(samples_in_encoder_, 0); |
| 115 | 116 |
| 116 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 117 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
| 117 } | 118 } |
| 118 | 119 |
| 119 } // namespace cast | 120 } // namespace cast |
| 120 } // namespace media | 121 } // namespace media |
| OLD | NEW |