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

Side by Side Diff: media/audio/simple_sources.h

Issue 1018293002: Make fake file audio input device not crash when it fails to read. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | media/audio/simple_sources.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 MEDIA_AUDIO_SIMPLE_SOURCES_H_ 5 #ifndef MEDIA_AUDIO_SIMPLE_SOURCES_H_
6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_ 6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "media/audio/audio_io.h" 10 #include "media/audio/audio_io.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override; 59 int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override;
60 void OnError(AudioOutputStream* stream) override; 60 void OnError(AudioOutputStream* stream) override;
61 61
62 private: 62 private:
63 AudioParameters params_; 63 AudioParameters params_;
64 base::FilePath path_to_wav_file_; 64 base::FilePath path_to_wav_file_;
65 scoped_ptr<uint8[]> wav_file_data_; 65 scoped_ptr<uint8[]> wav_file_data_;
66 scoped_ptr<WavAudioHandler> wav_audio_handler_; 66 scoped_ptr<WavAudioHandler> wav_audio_handler_;
67 scoped_ptr<AudioConverter> file_audio_converter_; 67 scoped_ptr<AudioConverter> file_audio_converter_;
68 int wav_file_read_pos_; 68 int wav_file_read_pos_;
69 bool load_failed_;
69 70
70 // Provides audio data from wav_audio_handler_ into the file audio converter. 71 // Provides audio data from wav_audio_handler_ into the file audio converter.
71 double ProvideInput(AudioBus* audio_bus, 72 double ProvideInput(AudioBus* audio_bus,
72 base::TimeDelta buffer_delay) override; 73 base::TimeDelta buffer_delay) override;
73 74
74 // Loads the wav file on the first OnMoreData invocation. 75 // Loads the wav file on the first OnMoreData invocation.
75 void LoadWavFile(const base::FilePath& path_to_wav_file); 76 void LoadWavFile(const base::FilePath& path_to_wav_file);
76 }; 77 };
77 78
78 class BeepingSource : public AudioOutputStream::AudioSourceCallback { 79 class BeepingSource : public AudioOutputStream::AudioSourceCallback {
(...skipping 13 matching lines...) Expand all
92 base::TimeTicks last_callback_time_; 93 base::TimeTicks last_callback_time_;
93 base::TimeDelta interval_from_last_beep_; 94 base::TimeDelta interval_from_last_beep_;
94 int beep_duration_in_buffers_; 95 int beep_duration_in_buffers_;
95 int beep_generated_in_buffers_; 96 int beep_generated_in_buffers_;
96 int beep_period_in_frames_; 97 int beep_period_in_frames_;
97 }; 98 };
98 99
99 } // namespace media 100 } // namespace media
100 101
101 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_ 102 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/simple_sources.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698