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

Side by Side Diff: media/audio/sounds/audio_stream_handler.h

Issue 1453233002: Improve input handling for WaveAudioHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Formatting Created 5 years 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 | « media/audio/simple_sources_unittest.cc ('k') | media/audio/sounds/audio_stream_handler.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SOUNDS_AUDIO_STREAM_HANDLER_H_ 5 #ifndef MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_
6 #define MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ 6 #define MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
12 #include "base/time/time.h"
12 #include "media/audio/audio_io.h" 13 #include "media/audio/audio_io.h"
13 #include "media/audio/audio_parameters.h" 14 #include "media/audio/audio_parameters.h"
14 #include "media/audio/sounds/wav_audio_handler.h"
15 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 class AudioManager; 19 class AudioManager;
20 20
21 // This class sends a sound to the audio manager. 21 // This class sends a sound to the audio manager.
22 class MEDIA_EXPORT AudioStreamHandler : public base::NonThreadSafe { 22 class MEDIA_EXPORT AudioStreamHandler : public base::NonThreadSafe {
23 public: 23 public:
24 class TestObserver { 24 class TestObserver {
(...skipping 21 matching lines...) Expand all
46 // and won't be changed during playback. Returns true iff new playback 46 // and won't be changed during playback. Returns true iff new playback
47 // was successfully started. 47 // was successfully started.
48 // 48 //
49 // NOTE: if current playback isn't at end of stream, playback request 49 // NOTE: if current playback isn't at end of stream, playback request
50 // is dropped, but true is returned. 50 // is dropped, but true is returned.
51 bool Play(); 51 bool Play();
52 52
53 // Stops current playback. 53 // Stops current playback.
54 void Stop(); 54 void Stop();
55 55
56 const WavAudioHandler& wav_audio_handler() const { return wav_audio_; } 56 // Get the duration of the WAV data passed in.
57 base::TimeDelta duration() const;
57 58
58 private: 59 private:
59 friend class AudioStreamHandlerTest; 60 friend class AudioStreamHandlerTest;
60 friend class SoundsManagerTest; 61 friend class SoundsManagerTest;
61 62
62 class AudioStreamContainer; 63 class AudioStreamContainer;
63 64
64 static void SetObserverForTesting(TestObserver* observer); 65 static void SetObserverForTesting(TestObserver* observer);
65 static void SetAudioSourceForTesting( 66 static void SetAudioSourceForTesting(
66 AudioOutputStream::AudioSourceCallback* source); 67 AudioOutputStream::AudioSourceCallback* source);
67 68
68 WavAudioHandler wav_audio_; 69 base::TimeDelta duration_;
69 scoped_ptr<AudioStreamContainer> stream_; 70 scoped_ptr<AudioStreamContainer> stream_;
70 71
71 bool initialized_;
72
73 DISALLOW_COPY_AND_ASSIGN(AudioStreamHandler); 72 DISALLOW_COPY_AND_ASSIGN(AudioStreamHandler);
74 }; 73 };
75 74
76 } // namespace media 75 } // namespace media
77 76
78 #endif // MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ 77 #endif // MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_
OLDNEW
« no previous file with comments | « media/audio/simple_sources_unittest.cc ('k') | media/audio/sounds/audio_stream_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698