Chromium Code Reviews| Index: webrtc/modules/utility/include/audio_frame_operations.h |
| diff --git a/webrtc/modules/utility/include/audio_frame_operations.h b/webrtc/modules/utility/include/audio_frame_operations.h |
| index e12e3e561be8d439fe5a59709149a875fc2b0509..5ae5ae1472360ed75910e8352dd4a7fef45a4854 100644 |
| --- a/webrtc/modules/utility/include/audio_frame_operations.h |
| +++ b/webrtc/modules/utility/include/audio_frame_operations.h |
| @@ -11,17 +11,26 @@ |
| #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_AUDIO_FRAME_OPERATIONS_H_ |
| #define WEBRTC_MODULES_UTILITY_INCLUDE_AUDIO_FRAME_OPERATIONS_H_ |
| +#include "webrtc/modules/include/module_common_types.h" |
| #include "webrtc/typedefs.h" |
| namespace webrtc { |
| -class AudioFrame; |
| - |
| // TODO(andrew): consolidate this with utility.h and audio_frame_manipulator.h. |
| // Change reference parameters to pointers. Consider using a namespace rather |
| // than a class. |
|
the sun
2016/10/19 09:23:17
Perhaps address that comment in a follow-up? Would
aleloi
2016/10/20 08:27:05
Acknowledged.
|
| class AudioFrameOperations { |
| public: |
| + // Add samples in |frame_to_add| with samples in |result_frame| |
| + // putting the results in |results_frame|. The fields |
| + // |vad_activity_| and |speech_type_| of the result frame are |
| + // updated. If |result_frame| is empty (|samples_per_channel_|==0), |
| + // the samples in |frame_to_add| are added to it. The number of |
| + // channels and number of samples per channel must match except when |
| + // |result_frame| is empty. |
|
aleloi
2016/10/18 11:38:04
I'll try to improve this comment somewhat.
|
| + static void AddFrames(const AudioFrame& frame_to_add, |
| + AudioFrame* result_frame); |
| + |
| // Upmixes mono |src_audio| to stereo |dst_audio|. This is an out-of-place |
| // operation, meaning src_audio and dst_audio must point to different |
| // buffers. It is the caller's responsibility to ensure that |dst_audio| is |
| @@ -53,11 +62,33 @@ class AudioFrameOperations { |
| static void Mute(AudioFrame* frame, bool previous_frame_muted, |
| bool current_frame_muted); |
| + // Zero out contents of frame. |
| + static void Mute(AudioFrame* frame); |
| + |
| + // Reset all members to their default state (except do not modify |
| + // the contents of |frame->data_|). |
| + static void Reset(AudioFrame* frame); |
| + |
| + // Apply a right shift by 1 on the samples in |frame|. |
| + static void ShiftDown(AudioFrame* frame); |
|
the sun
2016/10/19 09:23:17
Consider renaming to "HalfGain()", "ApplyHalfGain(
aleloi
2016/10/20 08:27:05
Done.
|
| + |
| static int Scale(float left, float right, AudioFrame& frame); |
| static int ScaleWithSat(float scale, AudioFrame& frame); |
| + |
| + static void UpdateFrame(int id, |
| + uint32_t timestamp, |
| + const int16_t* data, |
| + size_t samples_per_channel, |
| + int sample_rate_hz, |
| + AudioFrame::SpeechType speech_type, |
| + AudioFrame::VADActivity vad_activity, |
| + size_t num_channels, |
| + AudioFrame* frame); |
| }; |
| +int16_t ClampToInt16(int32_t input); |
|
the sun
2016/10/19 09:23:17
Add TODO to move this into a separate file (we pro
aleloi
2016/10/20 08:27:05
Done.
|
| + |
| } // namespace webrtc |
| #endif // #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_AUDIO_FRAME_OPERATIONS_H_ |