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

Side by Side Diff: content/browser/speech/audio_encoder.h

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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/net/test_url_fetcher_factory.cc ('k') | content/browser/speech/audio_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SPEECH_AUDIO_ENCODER_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_AUDIO_ENCODER_H_
6 #define CONTENT_BROWSER_SPEECH_AUDIO_ENCODER_H_ 6 #define CONTENT_BROWSER_SPEECH_AUDIO_ENCODER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 19 matching lines...) Expand all
30 // Encodes each frame of raw audio in |samples| to the internal buffer. Use 30 // Encodes each frame of raw audio in |samples| to the internal buffer. Use
31 // |GetEncodedData| to read the result after this call or when recording 31 // |GetEncodedData| to read the result after this call or when recording
32 // completes. 32 // completes.
33 virtual void Encode(const short* samples, int num_samples) = 0; 33 virtual void Encode(const short* samples, int num_samples) = 0;
34 34
35 // Finish encoding and flush any pending encoded bits out. 35 // Finish encoding and flush any pending encoded bits out.
36 virtual void Flush() = 0; 36 virtual void Flush() = 0;
37 37
38 // Copies the encoded audio to the given string. Returns true if the output 38 // Copies the encoded audio to the given string. Returns true if the output
39 // is not empty. 39 // is not empty.
40 bool GetEncodedData(std::string* encoded_data); 40 bool GetEncodedDataAndClear(std::string* encoded_data);
41 41
42 const std::string& mime_type() { return mime_type_; } 42 const std::string& mime_type() { return mime_type_; }
43 43
44 protected: 44 protected:
45 AudioEncoder(const std::string& mime_type); 45 AudioEncoder(const std::string& mime_type);
46 46
47 void AppendToBuffer(std::string* item); 47 void AppendToBuffer(std::string* item);
48 48
49 private: 49 private:
50 // Buffer holding the recorded audio. Owns the strings inside the list. 50 // Buffer holding the recorded audio. Owns the strings inside the list.
51 typedef std::list<std::string*> AudioBufferQueue; 51 typedef std::list<std::string*> AudioBufferQueue;
52 AudioBufferQueue audio_buffers_; 52 AudioBufferQueue audio_buffers_;
53 std::string mime_type_; 53 std::string mime_type_;
54 DISALLOW_COPY_AND_ASSIGN(AudioEncoder); 54 DISALLOW_COPY_AND_ASSIGN(AudioEncoder);
55 }; 55 };
56 56
57 } // namespace speech_input 57 } // namespace speech_input
58 58
59 #endif // CONTENT_BROWSER_SPEECH_AUDIO_ENCODER_H_ 59 #endif // CONTENT_BROWSER_SPEECH_AUDIO_ENCODER_H_
OLDNEW
« no previous file with comments | « chrome/common/net/test_url_fetcher_factory.cc ('k') | content/browser/speech/audio_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698