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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 // The number of samples per encoded audio frame depends on the codec and its | 50 // The number of samples per encoded audio frame depends on the codec and its |
51 // initialization parameters. Now that we have an encoder, we can calculate | 51 // initialization parameters. Now that we have an encoder, we can calculate |
52 // the maximum frame rate. | 52 // the maximum frame rate. |
53 max_frame_rate_ = | 53 max_frame_rate_ = |
54 audio_config.frequency / audio_encoder_->GetSamplesPerFrame(); | 54 audio_config.frequency / audio_encoder_->GetSamplesPerFrame(); |
55 | 55 |
56 media::cast::CastTransportRtpConfig transport_config; | 56 media::cast::CastTransportRtpConfig transport_config; |
57 transport_config.ssrc = audio_config.ssrc; | 57 transport_config.ssrc = audio_config.ssrc; |
58 transport_config.feedback_ssrc = audio_config.incoming_feedback_ssrc; | 58 transport_config.feedback_ssrc = audio_config.receiver_ssrc; |
59 transport_config.rtp_payload_type = audio_config.rtp_payload_type; | 59 transport_config.rtp_payload_type = audio_config.rtp_payload_type; |
60 transport_config.aes_key = audio_config.aes_key; | 60 transport_config.aes_key = audio_config.aes_key; |
61 transport_config.aes_iv_mask = audio_config.aes_iv_mask; | 61 transport_config.aes_iv_mask = audio_config.aes_iv_mask; |
62 | 62 |
63 transport_sender->InitializeAudio( | 63 transport_sender->InitializeAudio( |
64 transport_config, | 64 transport_config, |
65 base::Bind(&AudioSender::OnReceivedCastFeedback, | 65 base::Bind(&AudioSender::OnReceivedCastFeedback, |
66 weak_factory_.GetWeakPtr()), | 66 weak_factory_.GetWeakPtr()), |
67 base::Bind(&AudioSender::OnMeasuredRoundTripTime, | 67 base::Bind(&AudioSender::OnMeasuredRoundTripTime, |
68 weak_factory_.GetWeakPtr())); | 68 weak_factory_.GetWeakPtr())); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 111 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
112 | 112 |
113 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; | 113 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; |
114 DCHECK_GE(samples_in_encoder_, 0); | 114 DCHECK_GE(samples_in_encoder_, 0); |
115 | 115 |
116 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 116 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); |
117 } | 117 } |
118 | 118 |
119 } // namespace cast | 119 } // namespace cast |
120 } // namespace media | 120 } // namespace media |
OLD | NEW |