 Chromium Code Reviews
 Chromium Code Reviews Issue 4661001:
  Simplified AudioOutputStream interface.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 4661001:
  Simplified AudioOutputStream interface.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| 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 // A fake implementation of AudioOutputStream. It is used for testing purpose. | 5 // A fake implementation of AudioOutputStream. It is used for testing purpose. | 
| 6 // TODO(hclam): Implement a thread in this fake output stream to simulate an | 6 // TODO(hclam): Implement a thread in this fake output stream to simulate an | 
| 7 // audio output stream reading from AudioSourceCallback. | 7 // audio output stream reading from AudioSourceCallback. | 
| 8 | 8 | 
| 9 #ifndef MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ | 9 #ifndef MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ | 
| 10 #define MEDIA_AUDIO_FAKE_AUDIO_OUTOUT_STREAM_H_ | 10 #define MEDIA_AUDIO_FAKE_AUDIO_OUTOUT_STREAM_H_ | 
| 11 | 11 | 
| 12 #include <vector> | 12 #include <vector> | 
| 13 | 13 | 
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" | 
| 15 #include "media/audio/audio_io.h" | 15 #include "media/audio/audio_io.h" | 
| 16 #include "media/audio/audio_parameters.h" | |
| 16 | 17 | 
| 17 class FakeAudioOutputStream : public AudioOutputStream { | 18 class FakeAudioOutputStream : public AudioOutputStream { | 
| 18 public: | 19 public: | 
| 19 static AudioOutputStream* MakeFakeStream(); | 20 static AudioOutputStream* MakeFakeStream(AudioParameters params); | 
| 20 static FakeAudioOutputStream* GetLastFakeStream(); | 21 static FakeAudioOutputStream* GetLastFakeStream(); | 
| 21 | 22 | 
| 22 virtual bool Open(uint32 packet_size); | 23 virtual bool Open(); | 
| 23 virtual void Start(AudioSourceCallback* callback); | 24 virtual void Start(AudioSourceCallback* callback); | 
| 24 virtual void Stop(); | 25 virtual void Stop(); | 
| 25 virtual void SetVolume(double volume); | 26 virtual void SetVolume(double volume); | 
| 26 virtual void GetVolume(double* volume); | 27 virtual void GetVolume(double* volume); | 
| 27 virtual void Close(); | 28 virtual void Close(); | 
| 28 | 29 | 
| 29 uint8* buffer() { return buffer_.get(); } | 30 uint8* buffer() { return buffer_.get(); } | 
| 30 double volume() { return volume_; } | 31 double volume() { return volume_; } | 
| 31 | 32 | 
| 32 private: | 33 private: | 
| 33 FakeAudioOutputStream(); | 34 FakeAudioOutputStream(AudioParameters params); | 
| 
scherkus (not reviewing)
2010/11/09 02:28:31
explicit
 
Sergey Ulanov
2010/11/09 22:29:58
Done.
 | |
| 34 virtual ~FakeAudioOutputStream(); | 35 virtual ~FakeAudioOutputStream(); | 
| 35 | 36 | 
| 36 static void DestroyLastFakeStream(void* param); | 37 static void DestroyLastFakeStream(void* param); | 
| 37 static bool has_created_fake_stream_; | 38 static bool has_created_fake_stream_; | 
| 38 static FakeAudioOutputStream* last_fake_stream_; | 39 static FakeAudioOutputStream* last_fake_stream_; | 
| 39 | 40 | 
| 40 double volume_; | 41 double volume_; | 
| 41 AudioSourceCallback* callback_; | 42 AudioSourceCallback* callback_; | 
| 42 scoped_array<uint8> buffer_; | 43 scoped_array<uint8> buffer_; | 
| 43 uint32 packet_size_; | 44 uint32 packet_size_; | 
| 44 bool closed_; | 45 bool closed_; | 
| 45 | 46 | 
| 46 DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream); | 47 DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream); | 
| 47 }; | 48 }; | 
| 48 | 49 | 
| 49 #endif // MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ | 50 #endif // MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ | 
| OLD | NEW |