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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval), | 32 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval), |
33 audio_config.frequency, | 33 audio_config.frequency, |
34 audio_config.ssrc, | 34 audio_config.ssrc, |
35 kAudioFrameRate, | 35 kAudioFrameRate, |
36 audio_config.min_playout_delay, | 36 audio_config.min_playout_delay, |
37 audio_config.max_playout_delay, | 37 audio_config.max_playout_delay, |
38 NewFixedCongestionControl(audio_config.bitrate)), | 38 NewFixedCongestionControl(audio_config.bitrate)), |
39 samples_in_encoder_(0), | 39 samples_in_encoder_(0), |
40 weak_factory_(this) { | 40 weak_factory_(this) { |
41 cast_initialization_status_ = STATUS_AUDIO_UNINITIALIZED; | 41 cast_initialization_status_ = STATUS_AUDIO_UNINITIALIZED; |
42 VLOG(1) << "max_unacked_frames " << max_unacked_frames_; | |
43 DCHECK_GT(max_unacked_frames_, 0); | |
44 | 42 |
45 if (!audio_config.use_external_encoder) { | 43 if (!audio_config.use_external_encoder) { |
46 audio_encoder_.reset( | 44 audio_encoder_.reset( |
47 new AudioEncoder(cast_environment, | 45 new AudioEncoder(cast_environment, |
48 audio_config.channels, | 46 audio_config.channels, |
49 audio_config.frequency, | 47 audio_config.frequency, |
50 audio_config.bitrate, | 48 audio_config.bitrate, |
51 audio_config.codec, | 49 audio_config.codec, |
52 base::Bind(&AudioSender::OnEncodedAudioFrame, | 50 base::Bind(&AudioSender::OnEncodedAudioFrame, |
53 weak_factory_.GetWeakPtr(), | 51 weak_factory_.GetWeakPtr(), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 114 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
117 | 115 |
118 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; | 116 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; |
119 DCHECK_GE(samples_in_encoder_, 0); | 117 DCHECK_GE(samples_in_encoder_, 0); |
120 | 118 |
121 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 119 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
122 } | 120 } |
123 | 121 |
124 } // namespace cast | 122 } // namespace cast |
125 } // namespace media | 123 } // namespace media |
OLD | NEW |