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

Unified Diff: webrtc/modules/audio_coding/neteq/audio_vector.h

Issue 1948483002: Using ring buffer for AudioVector in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removing a unittest Created 4 years, 7 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/audio_vector.h
diff --git a/webrtc/modules/audio_coding/neteq/audio_vector.h b/webrtc/modules/audio_coding/neteq/audio_vector.h
index 15297f9bc8cd06cac78d6e4c89f03a80a45c0d94..756292aa783aabd0449bfd76d61a20ade77dca85 100644
--- a/webrtc/modules/audio_coding/neteq/audio_vector.h
+++ b/webrtc/modules/audio_coding/neteq/audio_vector.h
@@ -37,6 +37,9 @@ class AudioVector {
// |copy_to| will be an exact replica of this object.
virtual void CopyTo(AudioVector* copy_to) const;
+ // Copies |length| values from |position| in this vector to |copy_to|.
+ virtual void CopyTo(size_t length, size_t position, int16_t* copy_to) const;
+
// Prepends the contents of AudioVector |prepend_this| to this object. The
// length of this object is increased with the length of |prepend_this|.
virtual void PushFront(const AudioVector& prepend_this);
@@ -48,6 +51,12 @@ class AudioVector {
// Same as PushFront but will append to the end of this object.
virtual void PushBack(const AudioVector& append_this);
+ // Appends a segment of |append_this| to the end of this object. The segment
+ // starts from |position| and has |length| samples.
+ virtual void PushBack(const AudioVector& append_this,
+ size_t length,
+ size_t position);
+
// Same as PushFront but will append to the end of this object.
virtual void PushBack(const int16_t* append_this, size_t length);
@@ -71,6 +80,15 @@ class AudioVector {
// Like InsertAt, but inserts |length| zero elements at |position|.
virtual void InsertZerosAt(size_t length, size_t position);
+ // Overwrites |length| elements of this AudioVector starting from |position|
+ // with first values in |AudioVector|. The definition of |position|
+ // is the same as for InsertAt(). If |length| and |position| are selected
+ // such that the new data extends beyond the end of the current AudioVector,
+ // the vector is extended to accommodate the new data.
+ virtual void OverwriteAt(const AudioVector& insert_this,
+ size_t length,
+ size_t position);
+
// Overwrites |length| elements of this AudioVector with values taken from the
// array |insert_this|, starting at |position|. The definition of |position|
// is the same as for InsertAt(). If |length| and |position| are selected
@@ -100,11 +118,27 @@ class AudioVector {
void Reserve(size_t n);
+ void InsertByPushBack(const int16_t* insert_this, size_t length,
+ size_t position);
+
+ void InsertByPushFront(const int16_t* insert_this, size_t length,
+ size_t position);
+
+ void InsertZerosByPushBack(size_t length, size_t position);
+
+ void InsertZerosByPushFront(size_t length, size_t position);
+
std::unique_ptr<int16_t[]> array_;
- size_t first_free_ix_; // The first index after the last sample in array_.
- // Note that this index may point outside of array_.
+
size_t capacity_; // Allocated number of samples in the array.
+ // The index of the first sample in |array_|, except when
+ // |begin_index_ == end_index_|, which indicates an empty buffer.
+ size_t begin_index_;
+
+ // The index of the sample after the last sample in |array_|.
+ size_t end_index_;
+
RTC_DISALLOW_COPY_AND_ASSIGN(AudioVector);
};
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_multi_vector.cc ('k') | webrtc/modules/audio_coding/neteq/audio_vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698