Chromium Code Reviews| Index: content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| index 65d3d4ccede8d6d72ffc859396dab6b87777dc12..8a83642ecb4d1a5b1c3dcfe21980bf436983ce07 100644 |
| --- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| +++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| @@ -143,9 +143,12 @@ class WebRtcVideoCapturerAdapter::TextureFrameCopier |
| std::unique_ptr<media::SkCanvasVideoRenderer> canvas_video_renderer_; |
| }; |
| -WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter(bool is_screencast) |
| +WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter( |
| + bool is_screencast, |
| + blink::WebMediaStreamTrack::ContentHintType content_hint) |
| : texture_copier_(new WebRtcVideoCapturerAdapter::TextureFrameCopier()), |
| is_screencast_(is_screencast), |
| + content_hint_(content_hint), |
| running_(false) { |
| thread_checker_.DetachFromThread(); |
| } |
| @@ -300,8 +303,27 @@ bool WebRtcVideoCapturerAdapter::GetPreferredFourccs( |
| return true; |
| } |
| +void WebRtcVideoCapturerAdapter::SetContentHint( |
| + blink::WebMediaStreamTrack::ContentHintType content_hint) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + content_hint_ = content_hint; |
| +} |
| + |
| bool WebRtcVideoCapturerAdapter::IsScreencast() const { |
| - return is_screencast_; |
| + return !ShouldAdaptResolution(); |
| +} |
| + |
| +bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + if (content_hint_ == |
| + blink::WebMediaStreamTrack::ContentHintType::VideoFluid) { |
| + return true; |
| + } else if (content_hint_ == |
|
mcasas
2016/12/19 19:32:05
nit: no need for else{} after if(){ return }
pbos
2016/12/19 19:42:09
Done.
|
| + blink::WebMediaStreamTrack::ContentHintType::VideoDetailed) { |
| + return false; |
| + } |
| + // Screencast does not adapt by default. |
| + return !is_screencast_; |
| } |
| bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat( |