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

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

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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/video_frame_stream_unittest.cc ('k') | media/filters/video_renderer_algorithm.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_ALGORITHM_H_ 5 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_ALGORITHM_H_
6 #define MEDIA_FILTERS_VIDEO_RENDERER_ALGORITHM_H_ 6 #define MEDIA_FILTERS_VIDEO_RENDERER_ALGORITHM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // see VideoCadenceEstimator for details on this process. In cases of non- 44 // see VideoCadenceEstimator for details on this process. In cases of non-
45 // integer cadence, the algorithm will fall back to choosing the frame which 45 // integer cadence, the algorithm will fall back to choosing the frame which
46 // covers the most of the current render interval. If no frame covers the 46 // covers the most of the current render interval. If no frame covers the
47 // current interval, the least bad frame will be chosen based on its drift from 47 // current interval, the least bad frame will be chosen based on its drift from
48 // the start of the interval. 48 // the start of the interval.
49 // 49 //
50 // Combined these three approaches enforce optimal smoothness in many cases. 50 // Combined these three approaches enforce optimal smoothness in many cases.
51 class MEDIA_EXPORT VideoRendererAlgorithm { 51 class MEDIA_EXPORT VideoRendererAlgorithm {
52 public: 52 public:
53 VideoRendererAlgorithm(const TimeSource::WallClockTimeCB& wall_clock_time_cb, 53 VideoRendererAlgorithm(const TimeSource::WallClockTimeCB& wall_clock_time_cb,
54 scoped_refptr<MediaLog> media_log); 54 MediaLog* media_log);
55 ~VideoRendererAlgorithm(); 55 ~VideoRendererAlgorithm();
56 56
57 // Chooses the best frame for the interval [deadline_min, deadline_max] based 57 // Chooses the best frame for the interval [deadline_min, deadline_max] based
58 // on available and previously rendered frames. 58 // on available and previously rendered frames.
59 // 59 //
60 // Under ideal circumstances the deadline interval provided to a Render() call 60 // Under ideal circumstances the deadline interval provided to a Render() call
61 // should be directly adjacent to the deadline given to the previous Render() 61 // should be directly adjacent to the deadline given to the previous Render()
62 // call with no overlap or gaps. In practice, |deadline_max| is an estimated 62 // call with no overlap or gaps. In practice, |deadline_max| is an estimated
63 // value, which means the next |deadline_min| may overlap it slightly or have 63 // value, which means the next |deadline_min| may overlap it slightly or have
64 // a slight gap. Gaps which exceed the length of the deadline interval are 64 // a slight gap. Gaps which exceed the length of the deadline interval are
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Updates |effective_frames_queued_| which is typically called far more 260 // Updates |effective_frames_queued_| which is typically called far more
261 // frequently (~4x) than the value changes. This must be called whenever 261 // frequently (~4x) than the value changes. This must be called whenever
262 // frames are added or removed from the queue or when any property of a 262 // frames are added or removed from the queue or when any property of a
263 // ReadyFrame within the queue changes. 263 // ReadyFrame within the queue changes.
264 void UpdateEffectiveFramesQueued(); 264 void UpdateEffectiveFramesQueued();
265 265
266 // Computes the unclamped count of effective frames. Used by 266 // Computes the unclamped count of effective frames. Used by
267 // UpdateEffectiveFramesQueued(). 267 // UpdateEffectiveFramesQueued().
268 size_t CountEffectiveFramesQueued() const; 268 size_t CountEffectiveFramesQueued() const;
269 269
270 scoped_refptr<MediaLog> media_log_; 270 MediaLog* media_log_;
271 int out_of_order_frame_logs_ = 0; 271 int out_of_order_frame_logs_ = 0;
272 272
273 // Queue of incoming frames waiting for rendering. 273 // Queue of incoming frames waiting for rendering.
274 using VideoFrameQueue = std::deque<ReadyFrame>; 274 using VideoFrameQueue = std::deque<ReadyFrame>;
275 VideoFrameQueue frame_queue_; 275 VideoFrameQueue frame_queue_;
276 276
277 // Handles cadence detection and frame cadence assignments. 277 // Handles cadence detection and frame cadence assignments.
278 VideoCadenceEstimator cadence_estimator_; 278 VideoCadenceEstimator cadence_estimator_;
279 279
280 // Indicates if any calls to Render() have successfully yielded a frame yet. 280 // Indicates if any calls to Render() have successfully yielded a frame yet.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Current number of effective frames in the |frame_queue_|. Updated by calls 336 // Current number of effective frames in the |frame_queue_|. Updated by calls
337 // to UpdateEffectiveFramesQueued() whenever the |frame_queue_| is changed. 337 // to UpdateEffectiveFramesQueued() whenever the |frame_queue_| is changed.
338 size_t effective_frames_queued_; 338 size_t effective_frames_queued_;
339 339
340 DISALLOW_COPY_AND_ASSIGN(VideoRendererAlgorithm); 340 DISALLOW_COPY_AND_ASSIGN(VideoRendererAlgorithm);
341 }; 341 };
342 342
343 } // namespace media 343 } // namespace media
344 344
345 #endif // MEDIA_FILTERS_VIDEO_RENDERER_ALGORITHM_H_ 345 #endif // MEDIA_FILTERS_VIDEO_RENDERER_ALGORITHM_H_
OLDNEW
« no previous file with comments | « media/filters/video_frame_stream_unittest.cc ('k') | media/filters/video_renderer_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698