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

Side by Side Diff: content/renderer/media/video_track_adapter.cc

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LOG in video_Frame and CHECK/return outside. Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/media/video_track_adapter.h" 5 #include "content/renderer/media/video_track_adapter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 // Get the largest centered rectangle with the same aspect ratio of 256 // Get the largest centered rectangle with the same aspect ratio of
257 // |desired_size| that fits entirely inside of |frame->visible_rect()|. 257 // |desired_size| that fits entirely inside of |frame->visible_rect()|.
258 // This will be the rect we need to crop the original frame to. 258 // This will be the rect we need to crop the original frame to.
259 // From this rect, the original frame can be scaled down to |desired_size|. 259 // From this rect, the original frame can be scaled down to |desired_size|.
260 const gfx::Rect region_in_frame = 260 const gfx::Rect region_in_frame =
261 media::ComputeLetterboxRegion(frame->visible_rect(), desired_size); 261 media::ComputeLetterboxRegion(frame->visible_rect(), desired_size);
262 262
263 video_frame = 263 video_frame =
264 media::VideoFrame::WrapVideoFrame(frame, region_in_frame, desired_size); 264 media::VideoFrame::WrapVideoFrame(frame, region_in_frame, desired_size);
265 if (!video_frame)
266 return;
265 video_frame->AddDestructionObserver( 267 video_frame->AddDestructionObserver(
266 base::Bind(&ReleaseOriginalFrame, frame)); 268 base::Bind(&ReleaseOriginalFrame, frame));
267 269
268 DVLOG(3) << "desired size " << desired_size.ToString() 270 DVLOG(3) << "desired size " << desired_size.ToString()
269 << " output natural size " 271 << " output natural size "
270 << video_frame->natural_size().ToString() 272 << video_frame->natural_size().ToString()
271 << " output visible rect " 273 << " output visible rect "
272 << video_frame->visible_rect().ToString(); 274 << video_frame->visible_rect().ToString();
273 } 275 }
274 DoDeliverFrame(video_frame, estimated_capture_time); 276 DoDeliverFrame(video_frame, estimated_capture_time);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 } 508 }
507 509
508 io_task_runner_->PostDelayedTask( 510 io_task_runner_->PostDelayedTask(
509 FROM_HERE, base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this, 511 FROM_HERE, base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this,
510 set_muted_state_callback, frame_counter_), 512 set_muted_state_callback, frame_counter_),
511 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals / 513 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals /
512 source_frame_rate_)); 514 source_frame_rate_));
513 } 515 }
514 516
515 } // namespace content 517 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698