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

Unified Diff: media/audio/simple_sources.h

Issue 1453233002: Improve input handling for WaveAudioHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Formatting Created 5 years, 1 month 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 | « media/audio/BUILD.gn ('k') | media/audio/simple_sources.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/simple_sources.h
diff --git a/media/audio/simple_sources.h b/media/audio/simple_sources.h
index dcb04fd84534804913c4b827c51a77569ea46b1e..7a10a342032066880cb7a6bb14618a789eccd983 100644
--- a/media/audio/simple_sources.h
+++ b/media/audio/simple_sources.h
@@ -48,8 +48,8 @@ class MEDIA_EXPORT SineWaveAudioSource
base::Lock time_lock_;
};
-class FileSource : public AudioOutputStream::AudioSourceCallback,
- public AudioConverter::InputCallback {
+class MEDIA_EXPORT FileSource : public AudioOutputStream::AudioSourceCallback,
+ public AudioConverter::InputCallback {
public:
FileSource(const AudioParameters& params,
const base::FilePath& path_to_wav_file);
@@ -62,7 +62,12 @@ class FileSource : public AudioOutputStream::AudioSourceCallback,
private:
AudioParameters params_;
base::FilePath path_to_wav_file_;
- scoped_ptr<uint8[]> wav_file_data_;
+
+ // The WAV data at |path_to_wav_file_| is read into memory and kept here.
+ // This memory needs to survive for the lifetime of |wav_audio_handler_|,
+ // so declare it first. Do not access this member directly.
+ scoped_ptr<char[]> raw_wav_data_;
+
scoped_ptr<WavAudioHandler> wav_audio_handler_;
scoped_ptr<AudioConverter> file_audio_converter_;
int wav_file_read_pos_;
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/simple_sources.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698