| 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/media_stream_video_source.h" | 5 #include "content/renderer/media/media_stream_video_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 void MediaStreamVideoSource::DoStopSource() { | 362 void MediaStreamVideoSource::DoStopSource() { |
| 363 DCHECK(CalledOnValidThread()); | 363 DCHECK(CalledOnValidThread()); |
| 364 DVLOG(3) << "DoStopSource()"; | 364 DVLOG(3) << "DoStopSource()"; |
| 365 StopSourceImpl(); | 365 StopSourceImpl(); |
| 366 state_ = ENDED; | 366 state_ = ENDED; |
| 367 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 367 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void MediaStreamVideoSource::DeliverVideoFrame( | 370 void MediaStreamVideoSource::DeliverVideoFrame( |
| 371 const scoped_refptr<media::VideoFrame>& frame, | 371 const scoped_refptr<media::VideoFrame>& frame) { |
| 372 const media::VideoCaptureFormat& format) { | |
| 373 DCHECK(CalledOnValidThread()); | 372 DCHECK(CalledOnValidThread()); |
| 374 scoped_refptr<media::VideoFrame> video_frame(frame); | 373 scoped_refptr<media::VideoFrame> video_frame(frame); |
| 375 | 374 |
| 376 if (frame->visible_rect().size().width() > max_frame_output_size_.width() || | 375 if (frame->visible_rect().size().width() > max_frame_output_size_.width() || |
| 377 frame->visible_rect().size().height() > max_frame_output_size_.height()) { | 376 frame->visible_rect().size().height() > max_frame_output_size_.height()) { |
| 378 // If |frame| is not the size that is expected, we need to crop it by | 377 // If |frame| is not the size that is expected, we need to crop it by |
| 379 // providing a new |visible_rect|. The new visible rect must be within the | 378 // providing a new |visible_rect|. The new visible rect must be within the |
| 380 // original |visible_rect|. | 379 // original |visible_rect|. |
| 381 gfx::Rect output_rect = frame->visible_rect(); | 380 gfx::Rect output_rect = frame->visible_rect(); |
| 382 output_rect.ClampToCenteredSize(max_frame_output_size_); | 381 output_rect.ClampToCenteredSize(max_frame_output_size_); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 MediaStreamVideoSource::RequestedConstraints::RequestedConstraints( | 499 MediaStreamVideoSource::RequestedConstraints::RequestedConstraints( |
| 501 const blink::WebMediaConstraints& constraints, | 500 const blink::WebMediaConstraints& constraints, |
| 502 const ConstraintsCallback& callback) | 501 const ConstraintsCallback& callback) |
| 503 : constraints(constraints), callback(callback) { | 502 : constraints(constraints), callback(callback) { |
| 504 } | 503 } |
| 505 | 504 |
| 506 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() { | 505 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() { |
| 507 } | 506 } |
| 508 | 507 |
| 509 } // namespace content | 508 } // namespace content |
| OLD | NEW |