| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void* audioSamples, | 100 void* audioSamples, |
| 101 size_t& nSamplesOut, | 101 size_t& nSamplesOut, |
| 102 int64_t* elapsed_time_ms, | 102 int64_t* elapsed_time_ms, |
| 103 int64_t* ntp_time_ms) { | 103 int64_t* ntp_time_ms) { |
| 104 GetPlayoutData(static_cast<int>(samplesPerSec), nChannels, nSamples, true, | 104 GetPlayoutData(static_cast<int>(samplesPerSec), nChannels, nSamples, true, |
| 105 audioSamples, elapsed_time_ms, ntp_time_ms); | 105 audioSamples, elapsed_time_ms, ntp_time_ms); |
| 106 nSamplesOut = audioFrame_.samples_per_channel_; | 106 nSamplesOut = audioFrame_.samples_per_channel_; |
| 107 return 0; | 107 return 0; |
| 108 } | 108 } |
| 109 | 109 |
| 110 int VoEBaseImpl::OnDataAvailable(const int voe_channels[], | |
| 111 size_t number_of_voe_channels, | |
| 112 const int16_t* audio_data, int sample_rate, | |
| 113 size_t number_of_channels, | |
| 114 size_t number_of_frames, | |
| 115 int audio_delay_milliseconds, int volume, | |
| 116 bool key_pressed, bool need_audio_processing) { | |
| 117 if (number_of_voe_channels == 0) return 0; | |
| 118 | |
| 119 if (need_audio_processing) { | |
| 120 return ProcessRecordedDataWithAPM( | |
| 121 voe_channels, number_of_voe_channels, audio_data, sample_rate, | |
| 122 number_of_channels, number_of_frames, audio_delay_milliseconds, 0, | |
| 123 volume, key_pressed); | |
| 124 } | |
| 125 | |
| 126 // No need to go through the APM, demultiplex the data to each VoE channel, | |
| 127 // encode and send to the network. | |
| 128 for (size_t i = 0; i < number_of_voe_channels; ++i) { | |
| 129 // TODO(ajm): In the case where multiple channels are using the same codec | |
| 130 // rate, this path needlessly does extra conversions. We should convert once | |
| 131 // and share between channels. | |
| 132 PushCaptureData(voe_channels[i], audio_data, 16, sample_rate, | |
| 133 number_of_channels, number_of_frames); | |
| 134 } | |
| 135 | |
| 136 // Return 0 to indicate no need to change the volume. | |
| 137 return 0; | |
| 138 } | |
| 139 | |
| 140 void VoEBaseImpl::OnData(int voe_channel, const void* audio_data, | |
| 141 int bits_per_sample, int sample_rate, | |
| 142 size_t number_of_channels, size_t number_of_frames) { | |
| 143 PushCaptureData(voe_channel, audio_data, bits_per_sample, sample_rate, | |
| 144 number_of_channels, number_of_frames); | |
| 145 } | |
| 146 | |
| 147 void VoEBaseImpl::PushCaptureData(int voe_channel, const void* audio_data, | 110 void VoEBaseImpl::PushCaptureData(int voe_channel, const void* audio_data, |
| 148 int bits_per_sample, int sample_rate, | 111 int bits_per_sample, int sample_rate, |
| 149 size_t number_of_channels, | 112 size_t number_of_channels, |
| 150 size_t number_of_frames) { | 113 size_t number_of_frames) { |
| 151 voe::ChannelOwner ch = shared_->channel_manager().GetChannel(voe_channel); | 114 voe::ChannelOwner ch = shared_->channel_manager().GetChannel(voe_channel); |
| 152 voe::Channel* channel_ptr = ch.channel(); | 115 voe::Channel* channel_ptr = ch.channel(); |
| 153 if (!channel_ptr) return; | 116 if (!channel_ptr) return; |
| 154 | 117 |
| 155 if (channel_ptr->Sending()) { | 118 if (channel_ptr->Sending()) { |
| 156 channel_ptr->Demultiplex(static_cast<const int16_t*>(audio_data), | 119 channel_ptr->Demultiplex(static_cast<const int16_t*>(audio_data), |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 788 shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 826 "AssociateSendChannel() failed to locate accociate_send_channel"); | 789 "AssociateSendChannel() failed to locate accociate_send_channel"); |
| 827 return -1; | 790 return -1; |
| 828 } | 791 } |
| 829 | 792 |
| 830 channel_ptr->set_associate_send_channel(ch); | 793 channel_ptr->set_associate_send_channel(ch); |
| 831 return 0; | 794 return 0; |
| 832 } | 795 } |
| 833 | 796 |
| 834 } // namespace webrtc | 797 } // namespace webrtc |
| OLD | NEW |