Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: content/renderer/media/user_media_client_impl.cc

Issue 1731593002: Fix hotword module constantly restarting on Pixel 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/user_media_client_impl.cc
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc
index 204e631a90d1ae58ae047178755b3abc4b73136b..15153c113eb6e068c4d65b7d4ad6b8c213afe7d8 100644
--- a/content/renderer/media/user_media_client_impl.cc
+++ b/content/renderer/media/user_media_client_impl.cc
@@ -66,6 +66,19 @@ void GetMandatoryList(const blink::WebMediaConstraints& constraints,
}
}
+bool GetOptional(const blink::WebMediaConstraints& constraints,
+ const std::string& name,
+ std::string* value) {
+ if (constraints.isNull())
+ return false;
+ blink::WebString temp;
+ bool found =
+ constraints.getOptionalConstraintValue(base::UTF8ToUTF16(name), temp);
+ if (found)
+ *value = temp.utf8();
+ return found;
+}
+
void GetOptionalList(const blink::WebMediaConstraints constraints,
const std::string& name,
std::vector<std::string>* values) {
@@ -104,8 +117,8 @@ void CopyBlinkRequestToStreamControls(const blink::WebUserMediaRequest& request,
GetMandatoryList(request.videoConstraints(), kMediaStreamSourceId,
&controls->video.device_ids);
std::string hotword_string;
- GetMandatory(request.audioConstraints(), kMediaStreamAudioHotword,
- &hotword_string);
+ GetOptional(request.audioConstraints(), kMediaStreamAudioHotword,
+ &hotword_string);
if (hotword_string == "true")
controls->hotword_enabled = true;
// DCHECK for some combinations that seem to be unusual/useless
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698