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

Unified Diff: media/filters/video_renderer_base.h

Issue 8417019: Simplify VideoDecodeEngine interface by making everything synchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: recycling: vanquished Created 9 years, 2 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: media/filters/video_renderer_base.h
diff --git a/media/filters/video_renderer_base.h b/media/filters/video_renderer_base.h
index 2125e4586d3a568af41ec8d5e3afda505f8d53ab..1abc59ec5ce2b5279cb0e9f31d563a2ecf9aa613 100644
--- a/media/filters/video_renderer_base.h
+++ b/media/filters/video_renderer_base.h
@@ -88,25 +88,16 @@ class MEDIA_EXPORT VideoRendererBase
// class executes on.
virtual void OnFrameAvailable() = 0;
- void ReadInput(scoped_refptr<VideoFrame> frame);
-
private:
- // Callback from video decoder to deliver decoded video frames and decrements
- // |pending_reads_|.
- void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame);
-
- // Helper method that schedules an asynchronous read from the decoder and
- // increments |pending_reads_|.
- //
- // Safe to call from any thread.
- void ScheduleRead_Locked();
+ // Callback from the video decoder delivering decoded video frames.
+ void FrameReady(scoped_refptr<VideoFrame> frame);
- // Helper function to finished "flush" operation
- void OnFlushDone_Locked();
+ // Helper method that schedules an asynchronous read from the decoder as long
+ // as there isn't a pending read and we have capacity.
+ void AttemptRead_Locked();
- // Helper method that flushes all video frame in "ready queue" including
- // current frame into "done queue".
- void FlushBuffers_Locked();
+ // Attempts to complete flushing and transition into the flushed state.
+ void AttemptFlush_Locked();
// Calculates the duration to sleep for based on |current_frame_|'s timestamp,
// the next frame timestamp (may be NULL), and the provided playback rate.
@@ -119,7 +110,7 @@ class MEDIA_EXPORT VideoRendererBase
void EnterErrorState_Locked(PipelineStatus status);
// Helper function that flushes the buffers when a Stop() or error occurs.
- void DoStopOrErrorFlush_Locked();
+ void DoStopOrError_Locked();
// Used for accessing data members.
base::Lock lock_;
@@ -128,9 +119,9 @@ class MEDIA_EXPORT VideoRendererBase
// Queue of incoming frames as well as the current frame since the last time
// OnFrameAvailable() was called.
- typedef std::deque< scoped_refptr<VideoFrame> > VideoFrameQueue;
+ typedef std::deque<scoped_refptr<VideoFrame> > VideoFrameQueue;
VideoFrameQueue frames_queue_ready_;
- VideoFrameQueue frames_queue_done_;
+
scoped_refptr<VideoFrame> current_frame_;
scoped_refptr<VideoFrame> last_available_frame_;
@@ -184,10 +175,8 @@ class MEDIA_EXPORT VideoRendererBase
// Keeps track of our pending buffers. We *must* have no pending reads
// before executing the flush callback; We decrement it each time we receive
Ami GONE FROM CHROMIUM 2011/11/01 22:17:40 decrement/increment terminology is misleading in b
scherkus (not reviewing) 2011/11/03 04:55:59 Done.
- // a buffer and increment it each time we send a buffer out. therefore if
- // decoder provides buffer, |pending_reads_| is always non-positive and if
- // renderer provides buffer, |pending_reads_| is always non-negative.
- int pending_reads_;
+ // a buffer and increment it each time we send a buffer out.
+ bool pending_read_;
bool pending_paint_;
bool pending_paint_with_last_available_;
@@ -200,6 +189,8 @@ class MEDIA_EXPORT VideoRendererBase
base::TimeDelta seek_timestamp_;
+ VideoDecoder::FrameReadyCB frame_ready_cb_;
+
DISALLOW_COPY_AND_ASSIGN(VideoRendererBase);
};

Powered by Google App Engine
This is Rietveld 408576698