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..fc56970be64cb1d8cc56b957f9984b50185d955c 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,11 @@ 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. |
+ 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 +79,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 +117,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); |
}; |