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

Side by Side Diff: media/filters/video_renderer_base.h

Issue 5878007: Fix black video frames when seeking (which also fixes flashing poster issue). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Cache the last available video frame in VideoRendererBase instead of copying a bitmap. Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // VideoRendererBase creates its own thread for the sole purpose of timing frame 5 // VideoRendererBase creates its own thread for the sole purpose of timing frame
6 // presentation. It handles reading from the decoder and stores the results in 6 // presentation. It handles reading from the decoder and stores the results in
7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify 7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify
8 // when a frame is ready to display. 8 // when a frame is ready to display.
9 // 9 //
10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() 10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek()
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 int height_; 137 int height_;
138 VideoFrame::Format surface_format_; 138 VideoFrame::Format surface_format_;
139 VideoFrame::SurfaceType surface_type_; 139 VideoFrame::SurfaceType surface_type_;
140 140
141 // Queue of incoming frames as well as the current frame since the last time 141 // Queue of incoming frames as well as the current frame since the last time
142 // OnFrameAvailable() was called. 142 // OnFrameAvailable() was called.
143 typedef std::deque< scoped_refptr<VideoFrame> > VideoFrameQueue; 143 typedef std::deque< scoped_refptr<VideoFrame> > VideoFrameQueue;
144 VideoFrameQueue frames_queue_ready_; 144 VideoFrameQueue frames_queue_ready_;
145 VideoFrameQueue frames_queue_done_; 145 VideoFrameQueue frames_queue_done_;
146 scoped_refptr<VideoFrame> current_frame_; 146 scoped_refptr<VideoFrame> current_frame_;
147 scoped_refptr<VideoFrame> last_available_frame_;
147 148
148 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: 149 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb:
149 // always check |state_| to see if it was set to STOPPED after waking up! 150 // always check |state_| to see if it was set to STOPPED after waking up!
150 ConditionVariable frame_available_; 151 ConditionVariable frame_available_;
151 152
152 // State transition Diagram of this class: 153 // State transition Diagram of this class:
153 // [kUninitialized] -------> [kError] 154 // [kUninitialized] -------> [kError]
154 // | 155 // |
155 // | Initialize() 156 // | Initialize()
156 // V All frames returned 157 // V All frames returned
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Previous time returned from the pipeline. 194 // Previous time returned from the pipeline.
194 base::TimeDelta previous_time_; 195 base::TimeDelta previous_time_;
195 196
196 // Keeps track of our pending buffers. We *must* have no pending reads 197 // Keeps track of our pending buffers. We *must* have no pending reads
197 // before executing the flush callback; We decrement it each time we receive 198 // before executing the flush callback; We decrement it each time we receive
198 // a buffer and increment it each time we send a buffer out. therefore if 199 // a buffer and increment it each time we send a buffer out. therefore if
199 // decoder provides buffer, |pending_reads_| is always non-positive and if 200 // decoder provides buffer, |pending_reads_| is always non-positive and if
200 // renderer provides buffer, |pending_reads_| is always non-negative. 201 // renderer provides buffer, |pending_reads_| is always non-negative.
201 int pending_reads_; 202 int pending_reads_;
202 bool pending_paint_; 203 bool pending_paint_;
204 bool pending_paint_with_last_available_;
203 205
204 float playback_rate_; 206 float playback_rate_;
205 207
206 // Filter callbacks. 208 // Filter callbacks.
207 scoped_ptr<FilterCallback> flush_callback_; 209 scoped_ptr<FilterCallback> flush_callback_;
208 scoped_ptr<FilterCallback> seek_callback_; 210 scoped_ptr<FilterCallback> seek_callback_;
209 211
210 base::TimeDelta seek_timestamp_; 212 base::TimeDelta seek_timestamp_;
211 213
212 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); 214 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase);
213 }; 215 };
214 216
215 } // namespace media 217 } // namespace media
216 218
217 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ 219 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/video_renderer_base.cc » ('j') | media/filters/video_renderer_base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698