| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 // TODO(aleloi): Issue bugs.webrtc.org/3390. | 92 // TODO(aleloi): Issue bugs.webrtc.org/3390. |
| 93 // Audio frame timestamp. The 'timestamp_' field is set to dummy | 93 // Audio frame timestamp. The 'timestamp_' field is set to dummy |
| 94 // value '0', because it is only supported in the one channel case and | 94 // value '0', because it is only supported in the one channel case and |
| 95 // is then updated in the helper functions. | 95 // is then updated in the helper functions. |
| 96 audio_frame_for_mixing->UpdateFrame( | 96 audio_frame_for_mixing->UpdateFrame( |
| 97 -1, 0, nullptr, samples_per_channel, sample_rate, AudioFrame::kUndefined, | 97 -1, 0, nullptr, samples_per_channel, sample_rate, AudioFrame::kUndefined, |
| 98 AudioFrame::kVadUnknown, number_of_channels); | 98 AudioFrame::kVadUnknown, number_of_channels); |
| 99 | 99 |
| 100 if (mix_list.size() == 0) { | 100 if (mix_list.empty()) { |
| 101 CombineZeroFrames(audio_frame_for_mixing); | 101 CombineZeroFrames(audio_frame_for_mixing); |
| 102 } else if (mix_list.size() == 1) { | 102 } else if (mix_list.size() == 1) { |
| 103 CombineOneFrame(mix_list.front(), audio_frame_for_mixing); | 103 CombineOneFrame(mix_list.front(), audio_frame_for_mixing); |
| 104 } else { | 104 } else { |
| 105 std::vector<rtc::ArrayView<const int16_t>> input_frames; | 105 std::vector<rtc::ArrayView<const int16_t>> input_frames; |
| 106 for (size_t i = 0; i < mix_list.size(); ++i) { | 106 for (size_t i = 0; i < mix_list.size(); ++i) { |
| 107 input_frames.push_back(rtc::ArrayView<const int16_t>( | 107 input_frames.push_back(rtc::ArrayView<const int16_t>( |
| 108 mix_list[i]->data_, samples_per_channel * number_of_channels)); | 108 mix_list[i]->data_, samples_per_channel * number_of_channels)); |
| 109 } | 109 } |
| 110 CombineMultipleFrames(input_frames, audio_frame_for_mixing); | 110 CombineMultipleFrames(input_frames, audio_frame_for_mixing); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Instead we double the frame (with addition since left-shifting a | 163 // Instead we double the frame (with addition since left-shifting a |
| 164 // negative value is undefined). | 164 // negative value is undefined). |
| 165 AudioFrameOperations::Add(*audio_frame_for_mixing, audio_frame_for_mixing); | 165 AudioFrameOperations::Add(*audio_frame_for_mixing, audio_frame_for_mixing); |
| 166 } else { | 166 } else { |
| 167 std::transform(add_buffer.begin(), add_buffer.begin() + frame_length, | 167 std::transform(add_buffer.begin(), add_buffer.begin() + frame_length, |
| 168 audio_frame_for_mixing->data_, | 168 audio_frame_for_mixing->data_, |
| 169 [](int32_t a) { return rtc::saturated_cast<int16_t>(a); }); | 169 [](int32_t a) { return rtc::saturated_cast<int16_t>(a); }); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 } // namespace webrtc | 172 } // namespace webrtc |
| OLD | NEW |