OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2752 void Channel::ProcessAndEncodeAudio(const int16_t* audio_data, | 2752 void Channel::ProcessAndEncodeAudio(const int16_t* audio_data, |
2753 int sample_rate, | 2753 int sample_rate, |
2754 size_t number_of_frames, | 2754 size_t number_of_frames, |
2755 size_t number_of_channels) { | 2755 size_t number_of_channels) { |
2756 // Avoid posting as new task if sending was already stopped in StopSend(). | 2756 // Avoid posting as new task if sending was already stopped in StopSend(). |
2757 rtc::CritScope cs(&encoder_queue_lock_); | 2757 rtc::CritScope cs(&encoder_queue_lock_); |
2758 if (!encoder_queue_is_active_) { | 2758 if (!encoder_queue_is_active_) { |
2759 return; | 2759 return; |
2760 } | 2760 } |
2761 CodecInst codec; | 2761 CodecInst codec; |
2762 GetSendCodec(codec); | 2762 const int result = GetSendCodec(codec); |
2763 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame()); | 2763 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame()); |
2764 audio_frame->id_ = ChannelId(); | 2764 audio_frame->id_ = ChannelId(); |
2765 audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate); | 2765 // TODO(ossu): Investigate how this could happen. b/62909493 |
2766 audio_frame->num_channels_ = std::min(number_of_channels, codec.channels); | 2766 if (result == 0) { |
| 2767 audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate); |
| 2768 audio_frame->num_channels_ = std::min(number_of_channels, codec.channels); |
| 2769 } else { |
| 2770 audio_frame->sample_rate_hz_ = sample_rate; |
| 2771 audio_frame->num_channels_ = number_of_channels; |
| 2772 LOG(LS_WARNING) << "Unable to get send codec for channel " << ChannelId(); |
| 2773 RTC_NOTREACHED(); |
| 2774 } |
2767 RemixAndResample(audio_data, number_of_frames, number_of_channels, | 2775 RemixAndResample(audio_data, number_of_frames, number_of_channels, |
2768 sample_rate, &input_resampler_, audio_frame.get()); | 2776 sample_rate, &input_resampler_, audio_frame.get()); |
2769 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>( | 2777 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>( |
2770 new ProcessAndEncodeAudioTask(std::move(audio_frame), this))); | 2778 new ProcessAndEncodeAudioTask(std::move(audio_frame), this))); |
2771 } | 2779 } |
2772 | 2780 |
2773 void Channel::ProcessAndEncodeAudioOnTaskQueue(AudioFrame* audio_input) { | 2781 void Channel::ProcessAndEncodeAudioOnTaskQueue(AudioFrame* audio_input) { |
2774 RTC_DCHECK_RUN_ON(encoder_queue_); | 2782 RTC_DCHECK_RUN_ON(encoder_queue_); |
2775 RTC_DCHECK_GT(audio_input->samples_per_channel_, 0); | 2783 RTC_DCHECK_GT(audio_input->samples_per_channel_, 0); |
2776 RTC_DCHECK_LE(audio_input->num_channels_, 2); | 2784 RTC_DCHECK_LE(audio_input->num_channels_, 2); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3140 int64_t min_rtt = 0; | 3148 int64_t min_rtt = 0; |
3141 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3149 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3142 0) { | 3150 0) { |
3143 return 0; | 3151 return 0; |
3144 } | 3152 } |
3145 return rtt; | 3153 return rtt; |
3146 } | 3154 } |
3147 | 3155 |
3148 } // namespace voe | 3156 } // namespace voe |
3149 } // namespace webrtc | 3157 } // namespace webrtc |
OLD | NEW |