Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(828)

Unified Diff: webrtc/audio/audio_transport_proxy.cc

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: don't return from Add() too early Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/audio/audio_transport_proxy.cc
diff --git a/webrtc/audio/audio_transport_proxy.cc b/webrtc/audio/audio_transport_proxy.cc
index 4d2f9e30e1c217bae2381b3f75ee27b8aeb5fe85..8ae7005b0a2a6ba76bd4941d3c6081d07c0c7ecd 100644
--- a/webrtc/audio/audio_transport_proxy.cc
+++ b/webrtc/audio/audio_transport_proxy.cc
@@ -25,9 +25,13 @@ int Resample(const AudioFrame& frame,
resampler->InitializeIfNeeded(frame.sample_rate_hz_, destination_sample_rate,
number_of_channels);
+ // TODO(yujo): for muted input frames, don't resample. Either 1) allow
hlundin-webrtc 2017/03/16 14:47:48 I would suggest that this function simply writes t
yujo 2017/03/16 23:37:21 I think the correct answer is to push AudioFrame d
hlundin-webrtc 2017/03/17 14:29:38 I think the TODO now is good enough for this CL. I
+ // resampler to return output length without doing the resample, so we know
+ // how much to zero here; or 2) make resampler accept a hint that the input is
+ // zeroed.
return resampler->Resample(
- frame.data_, frame.samples_per_channel_ * number_of_channels, destination,
- number_of_channels * target_number_of_samples_per_channel);
+ frame.data(), frame.samples_per_channel_ * number_of_channels,
+ destination, number_of_channels * target_number_of_samples_per_channel);
}
} // namespace
@@ -77,7 +81,7 @@ int32_t AudioTransportProxy::NeedMorePlayData(const size_t nSamples,
// 100 = 1 second / data duration (10 ms).
RTC_DCHECK_EQ(nSamples * 100, samplesPerSec);
RTC_DCHECK_LE(nBytesPerSample * nSamples * nChannels,
- sizeof(AudioFrame::data_));
+ AudioFrame::kMaxDataSizeBytes);
mixer_->Mix(nChannels, &mixed_frame_);
*elapsed_time_ms = mixed_frame_.elapsed_time_ms_;
@@ -120,7 +124,7 @@ void AudioTransportProxy::PullRenderData(int bits_per_sample,
// 8 = bits per byte.
RTC_DCHECK_LE(bits_per_sample / 8 * number_of_frames * number_of_channels,
- sizeof(AudioFrame::data_));
+ AudioFrame::kMaxDataSizeBytes);
mixer_->Mix(number_of_channels, &mixed_frame_);
*elapsed_time_ms = mixed_frame_.elapsed_time_ms_;
*ntp_time_ms = mixed_frame_.ntp_time_ms_;

Powered by Google App Engine
This is Rietveld 408576698