| 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 27 matching lines...) Expand all Loading... |
| 38 static void StereoToMono(const int16_t* src_audio, size_t samples_per_channel, | 38 static void StereoToMono(const int16_t* src_audio, size_t samples_per_channel, |
| 39 int16_t* dst_audio); | 39 int16_t* dst_audio); |
| 40 // |frame.num_channels_| will be updated. This version checks that | 40 // |frame.num_channels_| will be updated. This version checks that |
| 41 // |num_channels_| is stereo. | 41 // |num_channels_| is stereo. |
| 42 static int StereoToMono(AudioFrame* frame); | 42 static int StereoToMono(AudioFrame* frame); |
| 43 | 43 |
| 44 // Swap the left and right channels of |frame|. Fails silently if |frame| is | 44 // Swap the left and right channels of |frame|. Fails silently if |frame| is |
| 45 // not stereo. | 45 // not stereo. |
| 46 static void SwapStereoChannels(AudioFrame* frame); | 46 static void SwapStereoChannels(AudioFrame* frame); |
| 47 | 47 |
| 48 // Zeros out the audio and sets |frame.energy| to zero. | 48 // Conditionally zero out contents of |frame| for implementing audio mute: |
| 49 static void Mute(AudioFrame& frame); | 49 // |previous_frame_muted| && |current_frame_muted| - Zero out whole frame. |
| 50 // |previous_frame_muted| && !|current_frame_muted| - Fade-in at frame start. |
| 51 // !|previous_frame_muted| && |current_frame_muted| - Fade-out at frame end. |
| 52 // !|previous_frame_muted| && !|current_frame_muted| - Leave frame untouched. |
| 53 static void Mute(AudioFrame* frame, bool previous_frame_muted, |
| 54 bool current_frame_muted); |
| 50 | 55 |
| 51 static int Scale(float left, float right, AudioFrame& frame); | 56 static int Scale(float left, float right, AudioFrame& frame); |
| 52 | 57 |
| 53 static int ScaleWithSat(float scale, AudioFrame& frame); | 58 static int ScaleWithSat(float scale, AudioFrame& frame); |
| 54 }; | 59 }; |
| 55 | 60 |
| 56 } // namespace webrtc | 61 } // namespace webrtc |
| 57 | 62 |
| 58 #endif // #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_AUDIO_FRAME_OPERATIONS_H_ | 63 #endif // #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_AUDIO_FRAME_OPERATIONS_H_ |
| OLD | NEW |