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

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

Issue 390733002: Revert of Remove media::VideoRenderer::SetPlaybackRate(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/video_renderer.h ('k') | media/filters/video_renderer_impl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ 5 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
6 #define MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ 6 #define MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const StatisticsCB& statistics_cb, 62 const StatisticsCB& statistics_cb,
63 const TimeCB& max_time_cb, 63 const TimeCB& max_time_cb,
64 const BufferingStateCB& buffering_state_cb, 64 const BufferingStateCB& buffering_state_cb,
65 const base::Closure& ended_cb, 65 const base::Closure& ended_cb,
66 const PipelineStatusCB& error_cb, 66 const PipelineStatusCB& error_cb,
67 const TimeDeltaCB& get_time_cb, 67 const TimeDeltaCB& get_time_cb,
68 const TimeDeltaCB& get_duration_cb) OVERRIDE; 68 const TimeDeltaCB& get_duration_cb) OVERRIDE;
69 virtual void Flush(const base::Closure& callback) OVERRIDE; 69 virtual void Flush(const base::Closure& callback) OVERRIDE;
70 virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE; 70 virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE;
71 virtual void Stop(const base::Closure& callback) OVERRIDE; 71 virtual void Stop(const base::Closure& callback) OVERRIDE;
72 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
72 73
73 // PlatformThread::Delegate implementation. 74 // PlatformThread::Delegate implementation.
74 virtual void ThreadMain() OVERRIDE; 75 virtual void ThreadMain() OVERRIDE;
75 76
76 private: 77 private:
77 // Callback for |video_frame_stream_| initialization. 78 // Callback for |video_frame_stream_| initialization.
78 void OnVideoFrameStreamInitialized(bool success); 79 void OnVideoFrameStreamInitialized(bool success);
79 80
80 // Callback for |video_frame_stream_| to deliver decoded video frames and 81 // Callback for |video_frame_stream_| to deliver decoded video frames and
81 // report video decoding status. 82 // report video decoding status.
82 void FrameReady(VideoFrameStream::Status status, 83 void FrameReady(VideoFrameStream::Status status,
83 const scoped_refptr<VideoFrame>& frame); 84 const scoped_refptr<VideoFrame>& frame);
84 85
85 // Helper method for adding a frame to |ready_frames_|. 86 // Helper method for adding a frame to |ready_frames_|.
86 void AddReadyFrame_Locked(const scoped_refptr<VideoFrame>& frame); 87 void AddReadyFrame_Locked(const scoped_refptr<VideoFrame>& frame);
87 88
88 // Helper method that schedules an asynchronous read from the 89 // Helper method that schedules an asynchronous read from the
89 // |video_frame_stream_| as long as there isn't a pending read and we have 90 // |video_frame_stream_| as long as there isn't a pending read and we have
90 // capacity. 91 // capacity.
91 void AttemptRead(); 92 void AttemptRead();
92 void AttemptRead_Locked(); 93 void AttemptRead_Locked();
93 94
94 // Called when VideoFrameStream::Reset() completes. 95 // Called when VideoFrameStream::Reset() completes.
95 void OnVideoFrameStreamResetDone(); 96 void OnVideoFrameStreamResetDone();
96 97
98 // Calculates the duration to sleep for based on |last_timestamp_|,
99 // the next frame timestamp (may be NULL), and the provided playback rate.
100 //
101 // We don't use |playback_rate_| to avoid locking.
102 base::TimeDelta CalculateSleepDuration(
103 const scoped_refptr<VideoFrame>& next_frame,
104 float playback_rate);
105
97 // Helper function that flushes the buffers when a Stop() or error occurs. 106 // Helper function that flushes the buffers when a Stop() or error occurs.
98 void DoStopOrError_Locked(); 107 void DoStopOrError_Locked();
99 108
100 // Runs |paint_cb_| with the next frame from |ready_frames_|. 109 // Runs |paint_cb_| with the next frame from |ready_frames_|.
101 // 110 //
102 // A read is scheduled to replace the frame. 111 // A read is scheduled to replace the frame.
103 void PaintNextReadyFrame_Locked(); 112 void PaintNextReadyFrame_Locked();
104 113
105 // Drops the next frame from |ready_frames_| and runs |statistics_cb_|. 114 // Drops the next frame from |ready_frames_| and runs |statistics_cb_|.
106 // 115 //
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 179
171 // Video thread handle. 180 // Video thread handle.
172 base::PlatformThreadHandle thread_; 181 base::PlatformThreadHandle thread_;
173 182
174 // Keep track of the outstanding read on the VideoFrameStream. Flushing can 183 // Keep track of the outstanding read on the VideoFrameStream. Flushing can
175 // only complete once the read has completed. 184 // only complete once the read has completed.
176 bool pending_read_; 185 bool pending_read_;
177 186
178 bool drop_frames_; 187 bool drop_frames_;
179 188
189 float playback_rate_;
190
180 BufferingState buffering_state_; 191 BufferingState buffering_state_;
181 192
182 // Playback operation callbacks. 193 // Playback operation callbacks.
183 base::Closure flush_cb_; 194 base::Closure flush_cb_;
184 195
185 // Event callbacks. 196 // Event callbacks.
186 PipelineStatusCB init_cb_; 197 PipelineStatusCB init_cb_;
187 StatisticsCB statistics_cb_; 198 StatisticsCB statistics_cb_;
188 TimeCB max_time_cb_; 199 TimeCB max_time_cb_;
189 BufferingStateCB buffering_state_cb_; 200 BufferingStateCB buffering_state_cb_;
(...skipping 19 matching lines...) Expand all
209 220
210 // NOTE: Weak pointers must be invalidated before all other member variables. 221 // NOTE: Weak pointers must be invalidated before all other member variables.
211 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; 222 base::WeakPtrFactory<VideoRendererImpl> weak_factory_;
212 223
213 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); 224 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl);
214 }; 225 };
215 226
216 } // namespace media 227 } // namespace media
217 228
218 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ 229 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/base/video_renderer.h ('k') | media/filters/video_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698