Commit 054f161c authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Add support for content-hint value "text"

At this time, it is treated the same as "detailed".

Bug: chromium:852701
Change-Id: I145c0ac9f93d2152aa5ac4a84a4a7f858c4f3fc3
Reviewed-on: https://chromium-review.googlesource.com/1111957Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570719}
parent 595ee0d0
...@@ -89,6 +89,8 @@ webrtc::VideoTrackInterface::ContentHint ContentHintTypeToWebRtcContentHint( ...@@ -89,6 +89,8 @@ webrtc::VideoTrackInterface::ContentHint ContentHintTypeToWebRtcContentHint(
return webrtc::VideoTrackInterface::ContentHint::kFluid; return webrtc::VideoTrackInterface::ContentHint::kFluid;
case blink::WebMediaStreamTrack::ContentHintType::kVideoDetail: case blink::WebMediaStreamTrack::ContentHintType::kVideoDetail:
return webrtc::VideoTrackInterface::ContentHint::kDetailed; return webrtc::VideoTrackInterface::ContentHint::kDetailed;
case blink::WebMediaStreamTrack::ContentHintType::kVideoText:
return webrtc::VideoTrackInterface::ContentHint::kText;
} }
NOTREACHED(); NOTREACHED();
return webrtc::VideoTrackInterface::ContentHint::kNone; return webrtc::VideoTrackInterface::ContentHint::kNone;
......
...@@ -209,7 +209,9 @@ bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const { ...@@ -209,7 +209,9 @@ bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const {
return true; return true;
} }
if (content_hint_ == if (content_hint_ ==
blink::WebMediaStreamTrack::ContentHintType::kVideoDetail) { blink::WebMediaStreamTrack::ContentHintType::kVideoDetail ||
content_hint_ ==
blink::WebMediaStreamTrack::ContentHintType::kVideoText) {
return false; return false;
} }
// Screencast does not adapt by default. // Screencast does not adapt by default.
......
...@@ -125,6 +125,14 @@ TEST_F(WebRtcVideoCapturerAdapterTest, ...@@ -125,6 +125,14 @@ TEST_F(WebRtcVideoCapturerAdapterTest,
blink::WebMediaStreamTrack::ContentHintType::kVideoDetail, false); blink::WebMediaStreamTrack::ContentHintType::kVideoDetail, false);
} }
TEST_F(WebRtcVideoCapturerAdapterTest,
NonScreencastAdapterDoesNotAdaptContentHintText) {
// Non-screenshare adapter should not adapt frames when detail is set.
TestContentHintResolutionAdaptation(
false, blink::WebMediaStreamTrack::ContentHintType::kNone, true,
blink::WebMediaStreamTrack::ContentHintType::kVideoText, false);
}
TEST_F(WebRtcVideoCapturerAdapterTest, TEST_F(WebRtcVideoCapturerAdapterTest,
NonScreencastAdapterAdaptsContentHintFluid) { NonScreencastAdapterAdaptsContentHintFluid) {
// Non-screenshare adapter should still adapt frames when motion is set. // Non-screenshare adapter should still adapt frames when motion is set.
......
...@@ -60,6 +60,8 @@ test(t => { ...@@ -60,6 +60,8 @@ test(t => {
assert_equals(video_track.contentHint, "motion"); assert_equals(video_track.contentHint, "motion");
video_track.contentHint = "detail"; video_track.contentHint = "detail";
assert_equals(video_track.contentHint, "detail"); assert_equals(video_track.contentHint, "detail");
video_track.contentHint = "text";
assert_equals(video_track.contentHint, "text");
video_track.contentHint = ""; video_track.contentHint = "";
assert_equals(video_track.contentHint, ""); assert_equals(video_track.contentHint, "");
}, "Accepts valid video contentHints"); }, "Accepts valid video contentHints");
......
...@@ -99,7 +99,8 @@ class WebMediaStreamTrack { ...@@ -99,7 +99,8 @@ class WebMediaStreamTrack {
kAudioSpeech, kAudioSpeech,
kAudioMusic, kAudioMusic,
kVideoMotion, kVideoMotion,
kVideoDetail kVideoDetail,
kVideoText
}; };
WebMediaStreamTrack() = default; WebMediaStreamTrack() = default;
......
...@@ -58,6 +58,7 @@ static const char kContentHintStringAudioSpeech[] = "speech"; ...@@ -58,6 +58,7 @@ static const char kContentHintStringAudioSpeech[] = "speech";
static const char kContentHintStringAudioMusic[] = "music"; static const char kContentHintStringAudioMusic[] = "music";
static const char kContentHintStringVideoMotion[] = "motion"; static const char kContentHintStringVideoMotion[] = "motion";
static const char kContentHintStringVideoDetail[] = "detail"; static const char kContentHintStringVideoDetail[] = "detail";
static const char kContentHintStringVideoText[] = "text";
// The set of constrainable properties for image capture is available at // The set of constrainable properties for image capture is available at
// https://w3c.github.io/mediacapture-image/#constrainable-properties // https://w3c.github.io/mediacapture-image/#constrainable-properties
...@@ -224,6 +225,8 @@ String MediaStreamTrack::ContentHint() const { ...@@ -224,6 +225,8 @@ String MediaStreamTrack::ContentHint() const {
return kContentHintStringVideoMotion; return kContentHintStringVideoMotion;
case WebMediaStreamTrack::ContentHintType::kVideoDetail: case WebMediaStreamTrack::ContentHintType::kVideoDetail:
return kContentHintStringVideoDetail; return kContentHintStringVideoDetail;
case WebMediaStreamTrack::ContentHintType::kVideoText:
return kContentHintStringVideoText;
} }
NOTREACHED(); NOTREACHED();
...@@ -255,6 +258,8 @@ void MediaStreamTrack::SetContentHint(const String& hint) { ...@@ -255,6 +258,8 @@ void MediaStreamTrack::SetContentHint(const String& hint) {
translated_hint = WebMediaStreamTrack::ContentHintType::kVideoMotion; translated_hint = WebMediaStreamTrack::ContentHintType::kVideoMotion;
} else if (hint == kContentHintStringVideoDetail) { } else if (hint == kContentHintStringVideoDetail) {
translated_hint = WebMediaStreamTrack::ContentHintType::kVideoDetail; translated_hint = WebMediaStreamTrack::ContentHintType::kVideoDetail;
} else if (hint == kContentHintStringVideoText) {
translated_hint = WebMediaStreamTrack::ContentHintType::kVideoText;
} else { } else {
// TODO(pbos): Log warning? // TODO(pbos): Log warning?
// Invalid values for video are to be ignored (similar to invalid enum // Invalid values for video are to be ignored (similar to invalid enum
......
...@@ -104,6 +104,7 @@ void MediaStreamComponent::SetContentHint( ...@@ -104,6 +104,7 @@ void MediaStreamComponent::SetContentHint(
break; break;
case WebMediaStreamTrack::ContentHintType::kVideoMotion: case WebMediaStreamTrack::ContentHintType::kVideoMotion:
case WebMediaStreamTrack::ContentHintType::kVideoDetail: case WebMediaStreamTrack::ContentHintType::kVideoDetail:
case WebMediaStreamTrack::ContentHintType::kVideoText:
DCHECK_EQ(MediaStreamSource::kTypeVideo, Source()->GetType()); DCHECK_EQ(MediaStreamSource::kTypeVideo, Source()->GetType());
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment