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/cast_defines.h" | 10 #include "media/cast/cast_defines.h" |
11 #include "media/cast/net/cast_transport_config.h" | 11 #include "media/cast/net/cast_transport_config.h" |
12 #include "media/cast/sender/audio_encoder.h" | 12 #include "media/cast/sender/audio_encoder.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 namespace cast { | 15 namespace cast { |
16 | 16 |
17 AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, | 17 AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, |
18 const AudioSenderConfig& audio_config, | 18 const AudioSenderConfig& audio_config, |
19 const StatusChangeCallback& status_change_cb, | 19 const StatusChangeCallback& status_change_cb, |
20 CastTransportSender* const transport_sender) | 20 CastTransportSender* const transport_sender) |
21 : FrameSender(cast_environment, | 21 : FrameSender(cast_environment, |
22 true, | 22 true, |
23 transport_sender, | 23 transport_sender, |
24 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval), | |
25 audio_config.frequency, | 24 audio_config.frequency, |
26 audio_config.ssrc, | 25 audio_config.ssrc, |
27 0, // |max_frame_rate_| is set after encoder initialization. | 26 0, // |max_frame_rate_| is set after encoder initialization. |
28 audio_config.min_playout_delay, | 27 audio_config.min_playout_delay, |
29 audio_config.max_playout_delay, | 28 audio_config.max_playout_delay, |
30 NewFixedCongestionControl(audio_config.bitrate)), | 29 NewFixedCongestionControl(audio_config.bitrate)), |
31 samples_in_encoder_(0), | 30 samples_in_encoder_(0), |
32 weak_factory_(this) { | 31 weak_factory_(this) { |
33 if (!audio_config.use_external_encoder) { | 32 if (!audio_config.use_external_encoder) { |
34 audio_encoder_.reset( | 33 audio_encoder_.reset( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 115 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
117 | 116 |
118 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; | 117 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; |
119 DCHECK_GE(samples_in_encoder_, 0); | 118 DCHECK_GE(samples_in_encoder_, 0); |
120 | 119 |
121 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 120 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
122 } | 121 } |
123 | 122 |
124 } // namespace cast | 123 } // namespace cast |
125 } // namespace media | 124 } // namespace media |
OLD | NEW |