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

Unified Diff: content/renderer/media/video_track_adapter.cc

Issue 964293002: VideoCaptureImpl & relatives small cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/video_track_adapter.cc
diff --git a/content/renderer/media/video_track_adapter.cc b/content/renderer/media/video_track_adapter.cc
index 855cf7674a643b902360a19f04d674c094f64236..af9eddfb5b9ac8d07779589bc1730184cdf6e84a 100644
--- a/content/renderer/media/video_track_adapter.cc
+++ b/content/renderer/media/video_track_adapter.cc
@@ -91,10 +91,9 @@ class VideoTrackAdapter::VideoFrameResolutionAdapter
virtual ~VideoFrameResolutionAdapter();
friend class base::RefCountedThreadSafe<VideoFrameResolutionAdapter>;
- virtual void DoDeliverFrame(
- const scoped_refptr<media::VideoFrame>& frame,
- const media::VideoCaptureFormat& format,
- const base::TimeTicks& estimated_capture_time);
+ void DoDeliverFrame(const scoped_refptr<media::VideoFrame>& frame,
+ const media::VideoCaptureFormat& format,
+ const base::TimeTicks& estimated_capture_time);
// Returns |true| if the input frame rate is higher that the requested max
// frame rate and |frame| should be dropped.
@@ -257,8 +256,7 @@ bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
// Do not drop frames if max frame rate hasn't been specified or the source
// frame rate is known and is lower than max.
if (max_frame_rate_ == 0.0f ||
- (source_frame_rate > 0 &&
- source_frame_rate <= max_frame_rate_)) {
+ (source_frame_rate > 0 && source_frame_rate <= max_frame_rate_)) {
return false;
}
@@ -308,16 +306,13 @@ bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
return true;
}
-void VideoTrackAdapter::
-VideoFrameResolutionAdapter::DoDeliverFrame(
+void VideoTrackAdapter::VideoFrameResolutionAdapter::DoDeliverFrame(
const scoped_refptr<media::VideoFrame>& frame,
const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time) {
DCHECK(io_thread_checker_.CalledOnValidThread());
- for (std::vector<VideoIdCallbackPair>::const_iterator it = callbacks_.begin();
- it != callbacks_.end(); ++it) {
- it->second.Run(frame, format, estimated_capture_time);
- }
+ for (const auto& it : callbacks_)
+ it.second.Run(frame, format, estimated_capture_time);
}
void VideoTrackAdapter::VideoFrameResolutionAdapter::AddCallback(
@@ -380,14 +375,13 @@ VideoTrackAdapter::~VideoTrackAdapter() {
DCHECK(adapters_.empty());
}
-void VideoTrackAdapter::AddTrack(
- const MediaStreamVideoTrack* track,
- VideoCaptureDeliverFrameCB frame_callback,
- int max_width,
- int max_height,
- double min_aspect_ratio,
- double max_aspect_ratio,
- double max_frame_rate) {
+void VideoTrackAdapter::AddTrack(const MediaStreamVideoTrack* track,
+ VideoCaptureDeliverFrameCB frame_callback,
+ int max_width,
+ int max_height,
+ double min_aspect_ratio,
+ double max_aspect_ratio,
+ double max_frame_rate) {
DCHECK(thread_checker_.CalledOnValidThread());
io_message_loop_->PostTask(
@@ -397,20 +391,18 @@ void VideoTrackAdapter::AddTrack(
min_aspect_ratio, max_aspect_ratio, max_frame_rate));
}
-void VideoTrackAdapter::AddTrackOnIO(
- const MediaStreamVideoTrack* track,
- VideoCaptureDeliverFrameCB frame_callback,
- const gfx::Size& max_frame_size,
- double min_aspect_ratio,
- double max_aspect_ratio,
- double max_frame_rate) {
+void VideoTrackAdapter::AddTrackOnIO(const MediaStreamVideoTrack* track,
+ VideoCaptureDeliverFrameCB frame_callback,
+ const gfx::Size& max_frame_size,
+ double min_aspect_ratio,
+ double max_aspect_ratio,
+ double max_frame_rate) {
DCHECK(io_message_loop_->BelongsToCurrentThread());
scoped_refptr<VideoFrameResolutionAdapter> adapter;
- for (FrameAdapters::const_iterator it = adapters_.begin();
- it != adapters_.end(); ++it) {
- if ((*it)->ConstraintsMatch(max_frame_size, min_aspect_ratio,
- max_aspect_ratio, max_frame_rate)) {
- adapter = it->get();
+ for (const auto& it : adapters_) {
+ if (it->ConstraintsMatch(max_frame_size, min_aspect_ratio,
+ max_aspect_ratio, max_frame_rate)) {
+ adapter = it.get();
break;
}
}
@@ -499,10 +491,8 @@ void VideoTrackAdapter::DeliverFrameOnIO(
DCHECK(io_message_loop_->BelongsToCurrentThread());
TRACE_EVENT0("video", "VideoTrackAdapter::DeliverFrameOnIO");
++frame_counter_;
- for (FrameAdapters::iterator it = adapters_.begin();
- it != adapters_.end(); ++it) {
- (*it)->DeliverFrame(frame, format, estimated_capture_time);
- }
+ for (const auto& it : adapters_)
+ it->DeliverFrame(frame, format, estimated_capture_time);
}
void VideoTrackAdapter::CheckFramesReceivedOnIO(

Powered by Google App Engine
This is Rietveld 408576698