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

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

Issue 2101022: refactoring decoder interface (Closed)
Patch Set: q Created 10 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/filters/decoder_base_unittest.cc ('k') | media/filters/video_renderer_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Implementors should avoid doing any sort of heavy work in this method and 75 // Implementors should avoid doing any sort of heavy work in this method and
76 // instead post a task to a common/worker thread to handle rendering. Slowing 76 // instead post a task to a common/worker thread to handle rendering. Slowing
77 // down the video thread may result in losing synchronization with audio. 77 // down the video thread may result in losing synchronization with audio.
78 // 78 //
79 // IMPORTANT: This method is called on the video renderer thread, which is 79 // IMPORTANT: This method is called on the video renderer thread, which is
80 // different from the thread OnInitialize(), OnStop(), and the rest of the 80 // different from the thread OnInitialize(), OnStop(), and the rest of the
81 // class executes on. 81 // class executes on.
82 virtual void OnFrameAvailable() = 0; 82 virtual void OnFrameAvailable() = 0;
83 83
84 private: 84 private:
85 // Read complete callback from video decoder and decrements |pending_reads_|. 85 // Callback from video decoder to deliver decoded video frames and decrements
86 void OnReadComplete(VideoFrame* frame); 86 // |pending_reads_|.
87 void OnFillBufferDone(scoped_refptr<VideoFrame> frame);
87 88
88 // Helper method that schedules an asynchronous read from the decoder and 89 // Helper method that schedules an asynchronous read from the decoder and
89 // increments |pending_reads_|. 90 // increments |pending_reads_|.
90 // 91 //
91 // Safe to call from any thread. 92 // Safe to call from any thread.
92 void ScheduleRead_Locked(); 93 void ScheduleRead_Locked();
93 94
94 // Calculates the duration to sleep for based on |current_frame_|'s timestamp, 95 // Calculates the duration to sleep for based on |current_frame_|'s timestamp,
95 // the next frame timestamp (may be NULL), and the provided playback rate. 96 // the next frame timestamp (may be NULL), and the provided playback rate.
96 // 97 //
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Filter callbacks. 152 // Filter callbacks.
152 scoped_ptr<FilterCallback> pause_callback_; 153 scoped_ptr<FilterCallback> pause_callback_;
153 scoped_ptr<FilterCallback> seek_callback_; 154 scoped_ptr<FilterCallback> seek_callback_;
154 155
155 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); 156 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase);
156 }; 157 };
157 158
158 } // namespace media 159 } // namespace media
159 160
160 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ 161 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_
OLDNEW
« no previous file with comments | « media/filters/decoder_base_unittest.cc ('k') | media/filters/video_renderer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698