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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 base::Bind(status_change_cb, | 54 base::Bind(status_change_cb, |
55 audio_encoder_ ? audio_encoder_->InitializationResult() : | 55 audio_encoder_ ? audio_encoder_->InitializationResult() : |
56 STATUS_INVALID_CONFIGURATION)); | 56 STATUS_INVALID_CONFIGURATION)); |
57 | 57 |
58 // The number of samples per encoded audio frame depends on the codec and its | 58 // The number of samples per encoded audio frame depends on the codec and its |
59 // initialization parameters. Now that we have an encoder, we can calculate | 59 // initialization parameters. Now that we have an encoder, we can calculate |
60 // the maximum frame rate. | 60 // the maximum frame rate. |
61 max_frame_rate_ = | 61 max_frame_rate_ = |
62 audio_config.frequency / audio_encoder_->GetSamplesPerFrame(); | 62 audio_config.frequency / audio_encoder_->GetSamplesPerFrame(); |
63 | 63 |
64 media::cast::CastTransportRtpConfig transport_config; | 64 media::cast::CastTransportRtpConfig transport_config; |
miu
2016/07/06 21:45:42
Lines 64-73 could be moved into the FrameSender co
xjz
2016/07/13 20:31:17
Done.
| |
65 transport_config.ssrc = audio_config.ssrc; | 65 transport_config.ssrc = audio_config.ssrc; |
66 transport_config.feedback_ssrc = audio_config.receiver_ssrc; | 66 transport_config.feedback_ssrc = audio_config.receiver_ssrc; |
67 transport_config.rtp_payload_type = audio_config.rtp_payload_type; | 67 transport_config.rtp_payload_type = audio_config.rtp_payload_type; |
68 transport_config.aes_key = audio_config.aes_key; | 68 transport_config.aes_key = audio_config.aes_key; |
69 transport_config.aes_iv_mask = audio_config.aes_iv_mask; | 69 transport_config.aes_iv_mask = audio_config.aes_iv_mask; |
70 | 70 |
71 transport_sender->InitializeAudio( | 71 transport_sender->InitializeStream( |
72 transport_config, base::WrapUnique(new FrameSender::RtcpClient( | 72 transport_config, base::WrapUnique(new FrameSender::RtcpClient( |
73 weak_factory_.GetWeakPtr()))); | 73 weak_factory_.GetWeakPtr()))); |
74 } | 74 } |
75 | 75 |
76 AudioSender::~AudioSender() {} | 76 AudioSender::~AudioSender() {} |
77 | 77 |
78 void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus, | 78 void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus, |
79 const base::TimeTicks& recorded_time) { | 79 const base::TimeTicks& recorded_time) { |
80 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 80 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
81 | 81 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 113 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
114 | 114 |
115 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; | 115 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; |
116 DCHECK_GE(samples_in_encoder_, 0); | 116 DCHECK_GE(samples_in_encoder_, 0); |
117 | 117 |
118 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); | 118 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); |
119 } | 119 } |
120 | 120 |
121 } // namespace cast | 121 } // namespace cast |
122 } // namespace media | 122 } // namespace media |
OLD | NEW |