| 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/webrtc/webrtc_video_capturer_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // MediaStreamTracks. What IsScreencast() really signals is whether or not | 315 // MediaStreamTracks. What IsScreencast() really signals is whether or not |
| 316 // video frames should ever be scaled before being handed over to WebRTC. | 316 // video frames should ever be scaled before being handed over to WebRTC. |
| 317 // TODO(pbos): Remove the need for IsScreencast() -> ShouldAdaptResolution() | 317 // TODO(pbos): Remove the need for IsScreencast() -> ShouldAdaptResolution() |
| 318 // by inlining VideoCapturer::AdaptFrame() and removing it from VideoCapturer. | 318 // by inlining VideoCapturer::AdaptFrame() and removing it from VideoCapturer. |
| 319 return !ShouldAdaptResolution(); | 319 return !ShouldAdaptResolution(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const { | 322 bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const { |
| 323 DCHECK(thread_checker_.CalledOnValidThread()); | 323 DCHECK(thread_checker_.CalledOnValidThread()); |
| 324 if (content_hint_ == | 324 if (content_hint_ == |
| 325 blink::WebMediaStreamTrack::ContentHintType::VideoFluid) { | 325 blink::WebMediaStreamTrack::ContentHintType::VideoMotion) { |
| 326 return true; | 326 return true; |
| 327 } | 327 } |
| 328 if (content_hint_ == | 328 if (content_hint_ == |
| 329 blink::WebMediaStreamTrack::ContentHintType::VideoDetailed) { | 329 blink::WebMediaStreamTrack::ContentHintType::VideoDetail) { |
| 330 return false; | 330 return false; |
| 331 } | 331 } |
| 332 // Screencast does not adapt by default. | 332 // Screencast does not adapt by default. |
| 333 return !is_screencast_; | 333 return !is_screencast_; |
| 334 } | 334 } |
| 335 | 335 |
| 336 bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat( | 336 bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat( |
| 337 const cricket::VideoFormat& desired, | 337 const cricket::VideoFormat& desired, |
| 338 cricket::VideoFormat* best_format) { | 338 cricket::VideoFormat* best_format) { |
| 339 DCHECK(thread_checker_.CalledOnValidThread()); | 339 DCHECK(thread_checker_.CalledOnValidThread()); |
| 340 DVLOG(3) << __func__ << " desired: " << desired.ToString(); | 340 DVLOG(3) << __func__ << " desired: " << desired.ToString(); |
| 341 | 341 |
| 342 // Capability enumeration is done in MediaStreamVideoSource. The adapter can | 342 // Capability enumeration is done in MediaStreamVideoSource. The adapter can |
| 343 // just use what is provided. | 343 // just use what is provided. |
| 344 // Use the desired format as the best format. | 344 // Use the desired format as the best format. |
| 345 best_format->width = desired.width; | 345 best_format->width = desired.width; |
| 346 best_format->height = desired.height; | 346 best_format->height = desired.height; |
| 347 best_format->fourcc = cricket::FOURCC_I420; | 347 best_format->fourcc = cricket::FOURCC_I420; |
| 348 best_format->interval = desired.interval; | 348 best_format->interval = desired.interval; |
| 349 return true; | 349 return true; |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace content | 352 } // namespace content |
| OLD | NEW |