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

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

Issue 399623008: Use audio thread for the fake input audio stream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the mac bots Created 6 years, 5 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 | « no previous file | media/audio/fake_audio_input_stream.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 // A fake implementation of AudioInputStream, useful for testing purpose. 5 // A fake implementation of AudioInputStream, useful for testing purpose.
6 6
7 #ifndef MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ 7 #ifndef MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_
8 #define MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ 8 #define MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_
9 9
10 #include <vector> 10 #include <vector>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 virtual ~FakeAudioInputStream(); 55 virtual ~FakeAudioInputStream();
56 56
57 void DoCallback(); 57 void DoCallback();
58 58
59 AudioManagerBase* audio_manager_; 59 AudioManagerBase* audio_manager_;
60 AudioInputCallback* callback_; 60 AudioInputCallback* callback_;
61 scoped_ptr<uint8[]> buffer_; 61 scoped_ptr<uint8[]> buffer_;
62 int buffer_size_; 62 int buffer_size_;
63 AudioParameters params_; 63 AudioParameters params_;
64 base::Thread thread_; 64 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
65 base::TimeTicks last_callback_time_; 65 base::TimeTicks last_callback_time_;
66 base::TimeDelta callback_interval_; 66 base::TimeDelta callback_interval_;
67 base::TimeDelta interval_from_last_beep_; 67 base::TimeDelta interval_from_last_beep_;
68 int beep_duration_in_buffers_; 68 int beep_duration_in_buffers_;
69 int beep_generated_in_buffers_; 69 int beep_generated_in_buffers_;
70 int beep_period_in_frames_; 70 int beep_period_in_frames_;
71 int frames_elapsed_; 71 int frames_elapsed_;
72 scoped_ptr<media::AudioBus> audio_bus_; 72 scoped_ptr<media::AudioBus> audio_bus_;
73 73
74 // Allows us to run tasks on the FakeAudioInputStream instance which are
75 // bound by its lifetime.
76 base::WeakPtrFactory<FakeAudioInputStream> weak_factory_;
77
74 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); 78 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream);
75 }; 79 };
76 80
77 } // namespace media 81 } // namespace media
78 82
79 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ 83 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/fake_audio_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698