Lines Matching refs:frame

80 int AudioFrameOperations::MonoToStereo(AudioFrame* frame) {  in MonoToStereo()  argument
81 if (frame->num_channels_ != 1) { in MonoToStereo()
84 if ((frame->samples_per_channel_ * 2) >= AudioFrame::kMaxDataSizeSamples) { in MonoToStereo()
89 if (!frame->muted()) { in MonoToStereo()
92 memcpy(data_copy, frame->data(), in MonoToStereo()
93 sizeof(int16_t) * frame->samples_per_channel_); in MonoToStereo()
94 MonoToStereo(data_copy, frame->samples_per_channel_, frame->mutable_data()); in MonoToStereo()
96 frame->num_channels_ = 2; in MonoToStereo()
110 int AudioFrameOperations::StereoToMono(AudioFrame* frame) { in StereoToMono() argument
111 if (frame->num_channels_ != 2) { in StereoToMono()
115 RTC_DCHECK_LE(frame->samples_per_channel_ * 2, in StereoToMono()
118 if (!frame->muted()) { in StereoToMono()
119 StereoToMono(frame->data(), frame->samples_per_channel_, in StereoToMono()
120 frame->mutable_data()); in StereoToMono()
122 frame->num_channels_ = 1; in StereoToMono()
139 int AudioFrameOperations::QuadToStereo(AudioFrame* frame) { in QuadToStereo() argument
140 if (frame->num_channels_ != 4) { in QuadToStereo()
144 RTC_DCHECK_LE(frame->samples_per_channel_ * 4, in QuadToStereo()
147 if (!frame->muted()) { in QuadToStereo()
148 QuadToStereo(frame->data(), frame->samples_per_channel_, in QuadToStereo()
149 frame->mutable_data()); in QuadToStereo()
151 frame->num_channels_ = 2; in QuadToStereo()
166 int AudioFrameOperations::QuadToMono(AudioFrame* frame) { in QuadToMono() argument
167 if (frame->num_channels_ != 4) { in QuadToMono()
171 RTC_DCHECK_LE(frame->samples_per_channel_ * 4, in QuadToMono()
174 if (!frame->muted()) { in QuadToMono()
175 QuadToMono(frame->data(), frame->samples_per_channel_, in QuadToMono()
176 frame->mutable_data()); in QuadToMono()
178 frame->num_channels_ = 1; in QuadToMono()
204 AudioFrame* frame) { in DownmixChannels() argument
205 if (frame->num_channels_ == 2 && dst_channels == 1) { in DownmixChannels()
206 return StereoToMono(frame); in DownmixChannels()
207 } else if (frame->num_channels_ == 4 && dst_channels == 2) { in DownmixChannels()
208 return QuadToStereo(frame); in DownmixChannels()
209 } else if (frame->num_channels_ == 4 && dst_channels == 1) { in DownmixChannels()
210 return QuadToMono(frame); in DownmixChannels()
216 void AudioFrameOperations::SwapStereoChannels(AudioFrame* frame) { in SwapStereoChannels() argument
217 RTC_DCHECK(frame); in SwapStereoChannels()
218 if (frame->num_channels_ != 2 || frame->muted()) { in SwapStereoChannels()
222 int16_t* frame_data = frame->mutable_data(); in SwapStereoChannels()
223 for (size_t i = 0; i < frame->samples_per_channel_ * 2; i += 2) { in SwapStereoChannels()
230 void AudioFrameOperations::Mute(AudioFrame* frame, in Mute() argument
233 RTC_DCHECK(frame); in Mute()
238 size_t total_samples = frame->samples_per_channel_ * frame->num_channels_; in Mute()
240 frame->Mute(); in Mute()
243 if (frame->muted()) { in Mute()
250 if (frame->samples_per_channel_ < kMuteFadeFrames) { in Mute()
251 count = frame->samples_per_channel_; in Mute()
263 start = frame->samples_per_channel_ - count; in Mute()
264 end = frame->samples_per_channel_; in Mute()
273 int16_t* frame_data = frame->mutable_data(); in Mute()
274 size_t channels = frame->num_channels_; in Mute()
285 void AudioFrameOperations::Mute(AudioFrame* frame) { in Mute() argument
286 Mute(frame, true, true); in Mute()
289 void AudioFrameOperations::ApplyHalfGain(AudioFrame* frame) { in ApplyHalfGain() argument
290 RTC_DCHECK(frame); in ApplyHalfGain()
291 RTC_DCHECK_GT(frame->num_channels_, 0); in ApplyHalfGain()
292 if (frame->num_channels_ < 1 || frame->muted()) { in ApplyHalfGain()
296 int16_t* frame_data = frame->mutable_data(); in ApplyHalfGain()
297 for (size_t i = 0; i < frame->samples_per_channel_ * frame->num_channels_; in ApplyHalfGain()
303 int AudioFrameOperations::Scale(float left, float right, AudioFrame* frame) { in Scale() argument
304 if (frame->num_channels_ != 2) { in Scale()
306 } else if (frame->muted()) { in Scale()
310 int16_t* frame_data = frame->mutable_data(); in Scale()
311 for (size_t i = 0; i < frame->samples_per_channel_; i++) { in Scale()
318 int AudioFrameOperations::ScaleWithSat(float scale, AudioFrame* frame) { in ScaleWithSat() argument
319 if (frame->muted()) { in ScaleWithSat()
323 int16_t* frame_data = frame->mutable_data(); in ScaleWithSat()
324 for (size_t i = 0; i < frame->samples_per_channel_ * frame->num_channels_; in ScaleWithSat()