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

Unified Diff: webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc

Issue 1750353002: Change NetEq::GetAudio to use AudioFrame (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 10 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index 1701c476e83294ac573504326659e2a109f718f6..a339199e2acddbd7861075473ebabfce8c93020a 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -382,8 +382,6 @@ size_t ReplacePayload(webrtc::test::InputAudioFile* replacement_audio_file,
} // namespace
int main(int argc, char* argv[]) {
- static const int kMaxChannels = 5;
- static const size_t kMaxSamplesPerMs = 48000 / 1000;
static const int kOutputBlockSizeMs = 10;
std::string program_name = argv[0];
@@ -606,26 +604,19 @@ int main(int argc, char* argv[]) {
// Check if it is time to get output audio.
while (time_now_ms >= next_output_time_ms && output_event_available) {
- static const size_t kOutDataLen =
- kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels;
- int16_t out_data[kOutDataLen];
- size_t num_channels;
- size_t samples_per_channel;
- int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel,
- &num_channels, NULL);
+ webrtc::AudioFrame out_frame;
+ int error = neteq->GetAudio(&out_frame, NULL);
if (error != NetEq::kOK) {
std::cerr << "GetAudio returned error code " <<
neteq->LastError() << std::endl;
} else {
- // Calculate sample rate from output size.
- sample_rate_hz = rtc::checked_cast<int>(
- 1000 * samples_per_channel / kOutputBlockSizeMs);
+ sample_rate_hz = out_frame.sample_rate_hz_;
}
// Write to file.
// TODO(hlundin): Make writing to file optional.
- size_t write_len = samples_per_channel * num_channels;
- if (!output->WriteArray(out_data, write_len)) {
+ if (!output->WriteArray(out_frame.data_, out_frame.samples_per_channel_ *
+ out_frame.num_channels_)) {
std::cerr << "Error while writing to file" << std::endl;
webrtc::Trace::ReturnTrace();
exit(1);
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698