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

Unified Diff: media/filters/audio_renderer_base.h

Issue 159476: Merge 21611 - Implemented proper pausethenseek behaviour for the media pipeli... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 5 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 | « media/base/pipeline_impl_unittest.cc ('k') | media/filters/audio_renderer_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_base.h
===================================================================
--- media/filters/audio_renderer_base.h (revision 21798)
+++ media/filters/audio_renderer_base.h (working copy)
@@ -30,6 +30,8 @@
class AudioRendererBase : public AudioRenderer {
public:
// MediaFilter implementation.
+ virtual void Play(FilterCallback* callback);
+ virtual void Pause(FilterCallback* callback);
virtual void Stop();
virtual void Seek(base::TimeDelta time, FilterCallback* callback);
@@ -54,7 +56,8 @@
// this time, such as stopping any running threads.
virtual void OnStop() = 0;
- // Called when a AudioDecoder::Read() completes.
+ // Called when a AudioDecoder::Read() completes and decrements
+ // |pending_reads_|.
virtual void OnReadComplete(Buffer* buffer_in);
// Fills the given buffer with audio data by dequeuing buffers and copying the
@@ -87,10 +90,11 @@
int* sample_bits_out);
private:
- // Helper method that schedules an asynchronous read from the decoder.
+ // Helper method that schedules an asynchronous read from the decoder and
+ // increments |pending_reads_|.
//
// Safe to call from any thread.
- void ScheduleRead();
+ void ScheduleRead_Locked();
// Audio decoder.
scoped_refptr<AudioDecoder> decoder_;
@@ -106,18 +110,31 @@
// Remembers the amount of remaining audio data for the front buffer.
size_t data_offset_;
- // Whether or not we're initialized.
- bool initialized_;
+ // Simple state tracking variable.
+ enum State {
+ kUninitialized,
+ kPaused,
+ kSeeking,
+ kPlaying,
+ kStopped,
+ kError,
+ };
+ State state_;
- // Whether or not we've stopped.
- bool stopped_;
+ // Keeps track of our pending reads. We *must* have no pending reads before
+ // executing the pause callback, otherwise we breach the contract that all
+ // filters are idling.
+ //
+ // We use size_t since we compare against std::deque::size().
+ size_t pending_reads_;
// Audio time at end of last call to FillBuffer().
// TODO(ralphl): Update this value after seeking.
base::TimeDelta last_fill_buffer_time_;
// Filter callbacks.
- scoped_ptr<FilterCallback> initialize_callback_;
+ scoped_ptr<FilterCallback> pause_callback_;
+ scoped_ptr<FilterCallback> seek_callback_;
DISALLOW_COPY_AND_ASSIGN(AudioRendererBase);
};
Property changes on: media\filters\audio_renderer_base.h
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/media/filters/audio_renderer_base.h:r69-2775
Merged /trunk/src/media/filters/audio_renderer_base.h:r21611
« no previous file with comments | « media/base/pipeline_impl_unittest.cc ('k') | media/filters/audio_renderer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698