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

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

Issue 6615020: Stream speech audio to server as it gets recorded, instead of waiting until end of recording. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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
Index: content/browser/speech/speech_recognition_request.cc
diff --git a/content/browser/speech/speech_recognition_request.cc b/content/browser/speech/speech_recognition_request.cc
index d1274377444c56d92c3bdda4e9bd509730c74bb4..fa6324fbe3a750b2c861db661399a9f2564c96e8 100644
--- a/content/browser/speech/speech_recognition_request.cc
+++ b/content/browser/speech/speech_recognition_request.cc
@@ -120,12 +120,11 @@ SpeechRecognitionRequest::SpeechRecognitionRequest(
SpeechRecognitionRequest::~SpeechRecognitionRequest() {}
-bool SpeechRecognitionRequest::Send(const std::string& language,
- const std::string& grammar,
- const std::string& hardware_info,
- const std::string& origin_url,
- const std::string& content_type,
- const std::string& audio_data) {
+void SpeechRecognitionRequest::Start(const std::string& language,
+ const std::string& grammar,
+ const std::string& hardware_info,
+ const std::string& origin_url,
+ const std::string& content_type) {
DCHECK(!url_fetcher_.get());
std::vector<std::string> parts;
@@ -160,7 +159,7 @@ bool SpeechRecognitionRequest::Send(const std::string& language,
url,
URLFetcher::POST,
this));
- url_fetcher_->set_upload_data(content_type, audio_data);
+ url_fetcher_->set_chunked_upload(content_type);
url_fetcher_->set_request_context(url_context_);
url_fetcher_->set_referrer(origin_url);
@@ -172,7 +171,12 @@ bool SpeechRecognitionRequest::Send(const std::string& language,
net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES |
net::LOAD_DO_NOT_SEND_AUTH_DATA);
url_fetcher_->Start();
- return true;
+}
+
+void SpeechRecognitionRequest::UploadAudioChunk(const std::string& audio_data,
+ bool is_last_chunk) {
+ DCHECK(url_fetcher_.get());
+ url_fetcher_->AppendChunkToUpload(audio_data, is_last_chunk);
}
void SpeechRecognitionRequest::OnURLFetchComplete(
« no previous file with comments | « content/browser/speech/speech_recognition_request.h ('k') | content/browser/speech/speech_recognition_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698