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

Unified Diff: content/browser/speech/google_streaming_remote_engine.cc

Issue 10629003: Adding support for the SpeechRecognition.maxAlternatives JS API parameter (Speech CL2.5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turned max_hypotheses to unsigned int Created 8 years, 6 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
Index: content/browser/speech/google_streaming_remote_engine.cc
diff --git a/content/browser/speech/google_streaming_remote_engine.cc b/content/browser/speech/google_streaming_remote_engine.cc
index 7fb2f6a92a56fa743a22cdc7eebdeeb5c22b3012..42e74cd0d5a1925e10313e7b2aa754b606638419 100644
--- a/content/browser/speech/google_streaming_remote_engine.cc
+++ b/content/browser/speech/google_streaming_remote_engine.cc
@@ -35,9 +35,6 @@ using net::URLFetcher;
namespace {
-// TODO(primiano) This shouldn't be a const, rather it should be taken from
-// maxNBest property (which is not yet implemented in WebKit).
-const int kMaxResults = 5;
const char kDownstreamUrl[] = "/down?";
const char kUpstreamUrl[] = "/up?";
const speech::AudioEncoder::Codec kDefaultAudioCodec =
@@ -322,8 +319,6 @@ GoogleStreamingRemoteEngine::ConnectBothStreams(const FSMEventArgs&) {
std::vector<std::string> downstream_args;
downstream_args.push_back("sky=" + GetWebserviceKey());
downstream_args.push_back("pair=" + request_key);
- downstream_args.push_back("maxresults=" + base::IntToString(kMaxResults));
-
GURL downstream_url(GetWebserviceBaseURL() + std::string(kDownstreamUrl) +
JoinString(downstream_args, '&'));
// TODO(primiano) /////////// Remove this after debug stage. /////////////
@@ -347,9 +342,12 @@ GoogleStreamingRemoteEngine::ConnectBothStreams(const FSMEventArgs&) {
"lang=" + net::EscapeQueryParamValue(GetAcceptedLanguages(), true));
upstream_args.push_back(
config_.filter_profanities ? "pfilter=2" : "pfilter=0");
- upstream_args.push_back("maxresults=" + base::IntToString(kMaxResults));
+ if (config_.max_hypotheses > 0U) {
+ upstream_args.push_back("maxresults=" +
+ base::UintToString(config_.max_hypotheses));
+ }
+ // TODO(primiano) What is this client= parameter? Check with speech team.
upstream_args.push_back("client=myapp.mycompany.com");
- // TODO(primiano) Can we remove this feature sending audio HW information?
if (!config_.hardware_info.empty()) {
upstream_args.push_back(
"xhw=" + net::EscapeQueryParamValue(config_.hardware_info, true));

Powered by Google App Engine
This is Rietveld 408576698