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..8af40d1978b8cb193a098ed494c0c02694acb403 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,28 @@ 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 { |
emircan
2016/12/19 21:14:27
Can you merge these functions then? It would be ea
pbos
2016/12/19 21:42:26
ShouldAdaptResolution makes more sense because the
emircan
2016/12/19 22:37:53
That's fine. Renaming that interface definitely be
|
- return is_screencast_; |
+ return !ShouldAdaptResolution(); |
+} |
+ |
+bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ if (content_hint_ == |
+ blink::WebMediaStreamTrack::ContentHintType::VideoFluid) { |
+ return true; |
+ } |
+ if (content_hint_ == |
+ blink::WebMediaStreamTrack::ContentHintType::VideoDetailed) { |
+ return false; |
+ } |
+ // Screencast does not adapt by default. |
+ return !is_screencast_; |
} |
bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat( |