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

Side by Side Diff: content/browser/media/capture/video_capture_oracle.h

Issue 1146723002: New FRAME_DURATION VideoFrameMetadata, with Cast Streaming use case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expanded comments for VideoFrameMetadata::FRAME_DURATION. Created 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 CONTENT_BROWSER_MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_
6 #define CONTENT_BROWSER_MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_ 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 // Notify of the completion of a capture. Returns true iff the captured frame 45 // Notify of the completion of a capture. Returns true iff the captured frame
46 // should be delivered. |frame_timestamp| is set to the timestamp that should 46 // should be delivered. |frame_timestamp| is set to the timestamp that should
47 // be provided to the consumer of the frame. 47 // be provided to the consumer of the frame.
48 bool CompleteCapture(int frame_number, base::TimeTicks* frame_timestamp); 48 bool CompleteCapture(int frame_number, base::TimeTicks* frame_timestamp);
49 49
50 base::TimeDelta min_capture_period() const { 50 base::TimeDelta min_capture_period() const {
51 return smoothing_sampler_.min_capture_period(); 51 return smoothing_sampler_.min_capture_period();
52 } 52 }
53 53
54 // Returns the oracle's estimate of the duration of the next frame. This
55 // should be called just after ObserveEventAndDecideCapture(), and will only
56 // be non-zero if the call returned true.
57 base::TimeDelta estimated_frame_duration() const {
58 return duration_of_next_frame_;
59 }
60
54 private: 61 private:
55 // Retrieve/Assign a frame timestamp by capture |frame_number|. 62 // Retrieve/Assign a frame timestamp by capture |frame_number|.
56 base::TimeTicks GetFrameTimestamp(int frame_number) const; 63 base::TimeTicks GetFrameTimestamp(int frame_number) const;
57 void SetFrameTimestamp(int frame_number, base::TimeTicks timestamp); 64 void SetFrameTimestamp(int frame_number, base::TimeTicks timestamp);
58 65
59 // Incremented every time a paint or update event occurs. 66 // Incremented every time a paint or update event occurs.
60 int frame_number_; 67 int frame_number_;
61 68
62 // Stores the last |event_time| from the last observation/decision. Used to 69 // Stores the last |event_time| from the last observation/decision. Used to
63 // sanity-check that event times are monotonically non-decreasing. 70 // sanity-check that event times are monotonically non-decreasing.
64 base::TimeTicks last_event_time_[kNumEvents]; 71 base::TimeTicks last_event_time_[kNumEvents];
65 72
73 // Updated by the last call to ObserveEventAndDecideCapture() with the
74 // estimated duration of the next frame to sample. This is zero if the method
75 // returned false.
76 base::TimeDelta duration_of_next_frame_;
77
66 // Stores the frame number from the last delivered frame. 78 // Stores the frame number from the last delivered frame.
67 int last_delivered_frame_number_; 79 int last_delivered_frame_number_;
68 80
69 // These track present/paint history and propose whether to sample each event 81 // These track present/paint history and propose whether to sample each event
70 // for capture. |smoothing_sampler_| uses a "works for all" heuristic, while 82 // for capture. |smoothing_sampler_| uses a "works for all" heuristic, while
71 // |content_sampler_| specifically detects animated content (e.g., video 83 // |content_sampler_| specifically detects animated content (e.g., video
72 // playback) and decides which events to sample to "lock into" that content. 84 // playback) and decides which events to sample to "lock into" that content.
73 SmoothEventSampler smoothing_sampler_; 85 SmoothEventSampler smoothing_sampler_;
74 AnimatedContentSampler content_sampler_; 86 AnimatedContentSampler content_sampler_;
75 87
76 // Recent history of frame timestamps proposed by VideoCaptureOracle. This is 88 // Recent history of frame timestamps proposed by VideoCaptureOracle. This is
77 // a ring-buffer, and should only be accessed by the Get/SetFrameTimestamp() 89 // a ring-buffer, and should only be accessed by the Get/SetFrameTimestamp()
78 // methods. 90 // methods.
79 enum { kMaxFrameTimestamps = 16 }; 91 enum { kMaxFrameTimestamps = 16 };
80 base::TimeTicks frame_timestamps_[kMaxFrameTimestamps]; 92 base::TimeTicks frame_timestamps_[kMaxFrameTimestamps];
81 }; 93 };
82 94
83 } // namespace content 95 } // namespace content
84 96
85 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_ 97 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_VIDEO_CAPTURE_ORACLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698