diff options
Diffstat (limited to 'media/audio/simple_sources.cc')
-rw-r--r-- | media/audio/simple_sources.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc index 228057b..1edd2b2 100644 --- a/media/audio/simple_sources.cc +++ b/media/audio/simple_sources.cc @@ -50,9 +50,8 @@ void SineWaveAudioSource::OnError(AudioOutputStream* stream, int code) { ////////////////////////////////////////////////////////////////////////////// // PushSource implementation. -PushSource::PushSource(uint32 packet_size) - : packet_size_(packet_size), - buffered_bytes_(0), +PushSource::PushSource() + : buffered_bytes_(0), front_buffer_consumed_(0) { } @@ -115,12 +114,18 @@ uint32 PushSource::UnProcessedBytes() { return buffered_bytes_; } +void PushSource::ClearAll() { + // Cleanup() will discard all the data. + CleanUp(); +} + void PushSource::CleanUp() { AutoLock auto_lock(lock_); PacketList::const_iterator it; for (it = packets_.begin(); it != packets_.end(); ++it) { delete [] it->buffer; - buffered_bytes_ -= it->size; } packets_.clear(); + buffered_bytes_ = 0; + front_buffer_consumed_ = 0; } |