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

Unified Diff: webrtc/modules/audio_coding/neteq/sync_buffer.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
Index: webrtc/modules/audio_coding/neteq/sync_buffer.cc
diff --git a/webrtc/modules/audio_coding/neteq/sync_buffer.cc b/webrtc/modules/audio_coding/neteq/sync_buffer.cc
index d1802e174fc9258f0d9ba07665c6bd1bd4923b72..543f78bdc4c4b85cfd761ab350f806ccdb9beef4 100644
--- a/webrtc/modules/audio_coding/neteq/sync_buffer.cc
+++ b/webrtc/modules/audio_coding/neteq/sync_buffer.cc
@@ -8,10 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <assert.h>
-
#include <algorithm> // Access to min.
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/neteq/sync_buffer.h"
namespace webrtc {
@@ -71,16 +70,18 @@ void SyncBuffer::ReplaceAtIndex(const AudioMultiVector& insert_this,
ReplaceAtIndex(insert_this, insert_this.Size(), position);
}
-size_t SyncBuffer::GetNextAudioInterleaved(size_t requested_len,
- int16_t* output) {
- if (!output) {
- assert(false);
- return 0;
- }
- size_t samples_to_read = std::min(FutureLength(), requested_len);
- ReadInterleavedFromIndex(next_index_, samples_to_read, output);
- next_index_ += samples_to_read;
- return samples_to_read;
+void SyncBuffer::GetNextAudioInterleaved(size_t requested_len,
+ AudioFrame* output) {
+ RTC_DCHECK(output);
+ const size_t samples_to_read = std::min(FutureLength(), requested_len);
+ output->Reset();
+ const size_t tot_samples_read =
+ ReadInterleavedFromIndex(next_index_, samples_to_read, output->data_);
+ const size_t samples_read_per_channel = tot_samples_read / Channels();
+ next_index_ += samples_read_per_channel;
+ output->interleaved_ = true;
+ output->num_channels_ = Channels();
+ output->samples_per_channel_ = samples_read_per_channel;
}
void SyncBuffer::IncreaseEndTimestamp(uint32_t increment) {
« no previous file with comments | « webrtc/modules/audio_coding/neteq/sync_buffer.h ('k') | webrtc/modules/audio_coding/neteq/sync_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698