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(
return webrtc::VideoTrackInterface::ContentHint::kFluid;
case blink::WebMediaStreamTrack::ContentHintType::kVideoDetail:
return webrtc::VideoTrackInterface::ContentHint::kDetailed;
case blink::WebMediaStreamTrack::ContentHintType::kVideoText:
return webrtc::VideoTrackInterface::ContentHint::kText;
}
NOTREACHED();
return webrtc::VideoTrackInterface::ContentHint::kNone;
......
......@@ -209,7 +209,9 @@ bool WebRtcVideoCapturerAdapter::ShouldAdaptResolution() const {
return true;
}
if (content_hint_ ==
blink::WebMediaStreamTrack::ContentHintType::kVideoDetail) {
blink::WebMediaStreamTrack::ContentHintType::kVideoDetail ||
content_hint_ ==
blink::WebMediaStreamTrack::ContentHintType::kVideoText) {
return false;
}
// Screencast does not adapt by default.
......
......@@ -125,6 +125,14 @@ TEST_F(WebRtcVideoCapturerAdapterTest,
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,
NonScreencastAdapterAdaptsContentHintFluid) {
// Non-screenshare adapter should still adapt frames when motion is set.
......
......@@ -60,6 +60,8 @@ test(t => {
assert_equals(video_track.contentHint, "motion");
video_track.contentHint = "detail";
assert_equals(video_track.contentHint, "detail");
video_track.contentHint = "text";
assert_equals(video_track.contentHint, "text");
video_track.contentHint = "";
assert_equals(video_track.contentHint, "");
}, "Accepts valid video contentHints");
......
......@@ -99,7 +99,8 @@ class WebMediaStreamTrack {
kAudioSpeech,
kAudioMusic,
kVideoMotion,
kVideoDetail
kVideoDetail,
kVideoText
};
WebMediaStreamTrack() = default;
......
......@@ -58,6 +58,7 @@ static const char kContentHintStringAudioSpeech[] = "speech";
static const char kContentHintStringAudioMusic[] = "music";
static const char kContentHintStringVideoMotion[] = "motion";
static const char kContentHintStringVideoDetail[] = "detail";
static const char kContentHintStringVideoText[] = "text";
// The set of constrainable properties for image capture is available at
// https://w3c.github.io/mediacapture-image/#constrainable-properties
......@@ -224,6 +225,8 @@ String MediaStreamTrack::ContentHint() const {
return kContentHintStringVideoMotion;
case WebMediaStreamTrack::ContentHintType::kVideoDetail:
return kContentHintStringVideoDetail;
case WebMediaStreamTrack::ContentHintType::kVideoText:
return kContentHintStringVideoText;
}
NOTREACHED();
......@@ -255,6 +258,8 @@ void MediaStreamTrack::SetContentHint(const String& hint) {
translated_hint = WebMediaStreamTrack::ContentHintType::kVideoMotion;
} else if (hint == kContentHintStringVideoDetail) {
translated_hint = WebMediaStreamTrack::ContentHintType::kVideoDetail;
} else if (hint == kContentHintStringVideoText) {
translated_hint = WebMediaStreamTrack::ContentHintType::kVideoText;
} else {
// TODO(pbos): Log warning?
// Invalid values for video are to be ignored (similar to invalid enum
......
......@@ -104,6 +104,7 @@ void MediaStreamComponent::SetContentHint(
break;
case WebMediaStreamTrack::ContentHintType::kVideoMotion:
case WebMediaStreamTrack::ContentHintType::kVideoDetail:
case WebMediaStreamTrack::ContentHintType::kVideoText:
DCHECK_EQ(MediaStreamSource::kTypeVideo, Source()->GetType());
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