OLD | NEW |
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 const gfx::Size desired_size(desired_width, desired_height); | 260 const gfx::Size desired_size(desired_width, desired_height); |
261 | 261 |
262 // Get the largest centered rectangle with the same aspect ratio of | 262 // Get the largest centered rectangle with the same aspect ratio of |
263 // |desired_size| that fits entirely inside of |frame->visible_rect()|. | 263 // |desired_size| that fits entirely inside of |frame->visible_rect()|. |
264 // This will be the rect we need to crop the original frame to. | 264 // This will be the rect we need to crop the original frame to. |
265 // From this rect, the original frame can be scaled down to |desired_size|. | 265 // From this rect, the original frame can be scaled down to |desired_size|. |
266 const gfx::Rect region_in_frame = | 266 const gfx::Rect region_in_frame = |
267 media::ComputeLetterboxRegion(frame->visible_rect(), desired_size); | 267 media::ComputeLetterboxRegion(frame->visible_rect(), desired_size); |
268 | 268 |
269 video_frame = | 269 video_frame = media::VideoFrame::WrapVideoFrame( |
270 media::VideoFrame::WrapVideoFrame(frame, region_in_frame, desired_size); | 270 frame, frame->format(), region_in_frame, desired_size); |
271 if (!video_frame) | 271 if (!video_frame) |
272 return; | 272 return; |
273 video_frame->AddDestructionObserver( | 273 video_frame->AddDestructionObserver( |
274 base::Bind(&ReleaseOriginalFrame, frame)); | 274 base::Bind(&ReleaseOriginalFrame, frame)); |
275 | 275 |
276 DVLOG(3) << "desired size " << desired_size.ToString() | 276 DVLOG(3) << "desired size " << desired_size.ToString() |
277 << " output natural size " | 277 << " output natural size " |
278 << video_frame->natural_size().ToString() | 278 << video_frame->natural_size().ToString() |
279 << " output visible rect " | 279 << " output visible rect " |
280 << video_frame->visible_rect().ToString(); | 280 << video_frame->visible_rect().ToString(); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 io_task_runner_->PostDelayedTask( | 516 io_task_runner_->PostDelayedTask( |
517 FROM_HERE, base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this, | 517 FROM_HERE, base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this, |
518 set_muted_state_callback, frame_counter_), | 518 set_muted_state_callback, frame_counter_), |
519 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals / | 519 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals / |
520 source_frame_rate_)); | 520 source_frame_rate_)); |
521 } | 521 } |
522 | 522 |
523 } // namespace content | 523 } // namespace content |
OLD | NEW |