| 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 d56e8d4f036b78c2b9f65576788402f83b5d6e16..746602a106cb0ff3f3189a56817fb71475e222e1 100644
|
| --- a/content/renderer/media/video_track_adapter.cc
|
| +++ b/content/renderer/media/video_track_adapter.cc
|
| @@ -49,10 +49,9 @@ void ResetCallbackOnMainRenderThread(
|
|
|
| } // anonymous namespace
|
|
|
| -// VideoFrameResolutionAdapter is created on and lives on
|
| -// on the IO-thread. It does the resolution adaptation and delivers frames to
|
| -// all registered tracks on the IO-thread.
|
| -// All method calls must be on the IO-thread.
|
| +// VideoFrameResolutionAdapter is created on and lives on the IO-thread. It does
|
| +// the resolution adaptation and delivers frames to all registered tracks on the
|
| +// IO-thread. All method calls must be on the IO-thread.
|
| class VideoTrackAdapter::VideoFrameResolutionAdapter
|
| : public base::RefCountedThreadSafe<VideoFrameResolutionAdapter> {
|
| public:
|
| @@ -90,9 +89,8 @@ class VideoTrackAdapter::VideoFrameResolutionAdapter
|
| virtual ~VideoFrameResolutionAdapter();
|
| friend class base::RefCountedThreadSafe<VideoFrameResolutionAdapter>;
|
|
|
| - virtual void DoDeliverFrame(
|
| - const scoped_refptr<media::VideoFrame>& frame,
|
| - const base::TimeTicks& estimated_capture_time);
|
| + void DoDeliverFrame(const scoped_refptr<media::VideoFrame>& frame,
|
| + 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.
|
| @@ -259,8 +257,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;
|
| }
|
|
|
| @@ -310,13 +307,12 @@ bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
|
| return true;
|
| }
|
|
|
| -void VideoTrackAdapter::
|
| -VideoFrameResolutionAdapter::DoDeliverFrame(
|
| +void VideoTrackAdapter::VideoFrameResolutionAdapter::DoDeliverFrame(
|
| const scoped_refptr<media::VideoFrame>& frame,
|
| const base::TimeTicks& estimated_capture_time) {
|
| DCHECK(io_thread_checker_.CalledOnValidThread());
|
| - for (const auto& entry : callbacks_)
|
| - entry.second.Run(frame, estimated_capture_time);
|
| + for (const auto& callback : callbacks_)
|
| + callback.second.Run(frame, estimated_capture_time);
|
| }
|
|
|
| void VideoTrackAdapter::VideoFrameResolutionAdapter::AddCallback(
|
| @@ -379,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(
|
| @@ -396,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& frame_adapter : adapters_) {
|
| + if (frame_adapter->ConstraintsMatch(max_frame_size, min_aspect_ratio,
|
| + max_aspect_ratio, max_frame_rate)) {
|
| + adapter = frame_adapter.get();
|
| break;
|
| }
|
| }
|
|
|