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

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

Issue 384943002: 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
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;
73 72
74 // PlatformThread::Delegate implementation. 73 // PlatformThread::Delegate implementation.
75 virtual void ThreadMain() OVERRIDE; 74 virtual void ThreadMain() OVERRIDE;
76 75
77 private: 76 private:
78 // Callback for |video_frame_stream_| initialization. 77 // Callback for |video_frame_stream_| initialization.
79 void OnVideoFrameStreamInitialized(bool success); 78 void OnVideoFrameStreamInitialized(bool success);
80 79
81 // Callback for |video_frame_stream_| to deliver decoded video frames and 80 // Callback for |video_frame_stream_| to deliver decoded video frames and
82 // report video decoding status. 81 // report video decoding status.
83 void FrameReady(VideoFrameStream::Status status, 82 void FrameReady(VideoFrameStream::Status status,
84 const scoped_refptr<VideoFrame>& frame); 83 const scoped_refptr<VideoFrame>& frame);
85 84
86 // Helper method for adding a frame to |ready_frames_|. 85 // Helper method for adding a frame to |ready_frames_|.
87 void AddReadyFrame_Locked(const scoped_refptr<VideoFrame>& frame); 86 void AddReadyFrame_Locked(const scoped_refptr<VideoFrame>& frame);
88 87
89 // Helper method that schedules an asynchronous read from the 88 // Helper method that schedules an asynchronous read from the
90 // |video_frame_stream_| as long as there isn't a pending read and we have 89 // |video_frame_stream_| as long as there isn't a pending read and we have
91 // capacity. 90 // capacity.
92 void AttemptRead(); 91 void AttemptRead();
93 void AttemptRead_Locked(); 92 void AttemptRead_Locked();
94 93
95 // Called when VideoFrameStream::Reset() completes. 94 // Called when VideoFrameStream::Reset() completes.
96 void OnVideoFrameStreamResetDone(); 95 void OnVideoFrameStreamResetDone();
97 96
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
106 // Helper function that flushes the buffers when a Stop() or error occurs. 97 // Helper function that flushes the buffers when a Stop() or error occurs.
107 void DoStopOrError_Locked(); 98 void DoStopOrError_Locked();
108 99
109 // Runs |paint_cb_| with the next frame from |ready_frames_|. 100 // Runs |paint_cb_| with the next frame from |ready_frames_|.
110 // 101 //
111 // A read is scheduled to replace the frame. 102 // A read is scheduled to replace the frame.
112 void PaintNextReadyFrame_Locked(); 103 void PaintNextReadyFrame_Locked();
113 104
114 // Drops the next frame from |ready_frames_| and runs |statistics_cb_|. 105 // Drops the next frame from |ready_frames_| and runs |statistics_cb_|.
115 // 106 //
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 170
180 // Video thread handle. 171 // Video thread handle.
181 base::PlatformThreadHandle thread_; 172 base::PlatformThreadHandle thread_;
182 173
183 // Keep track of the outstanding read on the VideoFrameStream. Flushing can 174 // Keep track of the outstanding read on the VideoFrameStream. Flushing can
184 // only complete once the read has completed. 175 // only complete once the read has completed.
185 bool pending_read_; 176 bool pending_read_;
186 177
187 bool drop_frames_; 178 bool drop_frames_;
188 179
189 float playback_rate_;
190
191 BufferingState buffering_state_; 180 BufferingState buffering_state_;
192 181
193 // Playback operation callbacks. 182 // Playback operation callbacks.
194 base::Closure flush_cb_; 183 base::Closure flush_cb_;
195 184
196 // Event callbacks. 185 // Event callbacks.
197 PipelineStatusCB init_cb_; 186 PipelineStatusCB init_cb_;
198 StatisticsCB statistics_cb_; 187 StatisticsCB statistics_cb_;
199 TimeCB max_time_cb_; 188 TimeCB max_time_cb_;
200 BufferingStateCB buffering_state_cb_; 189 BufferingStateCB buffering_state_cb_;
(...skipping 19 matching lines...) Expand all
220 209
221 // NOTE: Weak pointers must be invalidated before all other member variables. 210 // NOTE: Weak pointers must be invalidated before all other member variables.
222 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; 211 base::WeakPtrFactory<VideoRendererImpl> weak_factory_;
223 212
224 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); 213 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl);
225 }; 214 };
226 215
227 } // namespace media 216 } // namespace media
228 217
229 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ 218 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698