Chromium Code Reviews| 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, |
|
wolenetz
2015/03/02 23:51:09
nit: ditto update CL description to include this,
mcasas
2015/03/03 15:40:52
Acknowledged.
|
| + 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( |