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

Side by Side Diff: media/filters/reference_audio_renderer.h

Issue 8631001: Fix player_x11 crash with --audio; new audio renderer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make it work. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_FILTERS_REFERENCE_AUDIO_RENDERER_H_ 5 #ifndef MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_
6 #define MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_ 6 #define MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_
7 7
8 // This is the reference implementation of AudioRenderer, which uses the audio 8 // This is the reference implementation of AudioRenderer, which uses the audio
9 // interfaces to open an audio device. It cannot be used in the sandbox, but is 9 // interfaces to open an audio device. It cannot be used in the sandbox, but is
10 // used in other applications such as the test player. 10 // used in other applications such as the test player.
11 // 11 //
12 // Note: THIS IS NOT THE AUDIO RENDERER USED IN CHROME. 12 // Note: THIS IS NOT THE AUDIO RENDERER USED IN CHROME.
13 // 13 //
14 // See src/chrome/renderer/media/audio_renderer_impl.h for chrome's 14 // See src/chrome/renderer/media/audio_renderer_impl.h for chrome's
scherkus (not reviewing) 2011/11/23 01:40:22 want to update this to chrome -> content
DaleCurtis 2011/11/23 02:30:06 Done.
15 // implementation. 15 // implementation.
16 16
17 #include <deque> 17 #include "media/audio/audio_output_controller.h"
18 #include "media/filters/audio_renderer_base.h"
18 19
19 #include "media/audio/audio_io.h"
20 #include "media/base/buffers.h"
21 #include "media/base/filters.h"
22 #include "media/filters/audio_renderer_base.h"
23 20
24 namespace media { 21 namespace media {
25 22
26 class MEDIA_EXPORT ReferenceAudioRenderer 23 class MEDIA_EXPORT ReferenceAudioRenderer
27 : public AudioRendererBase, 24 : public AudioRendererBase,
28 public AudioOutputStream::AudioSourceCallback { 25 public AudioOutputController::EventHandler {
29 public: 26 public:
30 ReferenceAudioRenderer(); 27 ReferenceAudioRenderer();
31 virtual ~ReferenceAudioRenderer(); 28 virtual ~ReferenceAudioRenderer();
32 29
33 // Filter implementation. 30 // Filter implementation.
34 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; 31 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
35 32
36 // AudioRenderer implementation. 33 // AudioRenderer implementation.
37 virtual void SetVolume(float volume) OVERRIDE; 34 virtual void SetVolume(float volume) OVERRIDE;
38 35
39 // AudioSourceCallback implementation. 36 // AudioController::EventHandler implementation.
40 virtual uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, 37 virtual void OnCreated(AudioOutputController* controller) OVERRIDE;
41 uint32 len, 38 virtual void OnPlaying(AudioOutputController* controller) OVERRIDE;
42 AudioBuffersState buffers_state) OVERRIDE; 39 virtual void OnPaused(AudioOutputController* controller) OVERRIDE;
43 virtual void OnClose(AudioOutputStream* stream); 40 virtual void OnError(AudioOutputController* controller,
44 virtual void OnError(AudioOutputStream* stream, int code) OVERRIDE; 41 int error_code) OVERRIDE;
42 virtual void OnMoreData(AudioOutputController* controller,
43 AudioBuffersState buffers_state) OVERRIDE;
45 44
46 protected: 45 protected:
47 // AudioRendererBase implementation. 46 // AudioRendererBase implementation.
48 virtual bool OnInitialize(int bits_per_channel, 47 virtual bool OnInitialize(int bits_per_channel,
49 ChannelLayout channel_layout, 48 ChannelLayout channel_layout,
50 int sample_rate) OVERRIDE; 49 int sample_rate) OVERRIDE;
51 virtual void OnStop() OVERRIDE; 50 virtual void OnStop() OVERRIDE;
52 51
53 private: 52 private:
54 // Audio output stream device.
55 AudioOutputStream* stream_;
56 int bytes_per_second_; 53 int bytes_per_second_;
57 54
55 // AudioOutputController::Close callback.
56 virtual void OnClose();
57
58 // Audio output controller.
59 scoped_refptr<media::AudioOutputController> controller_;
60
61 // Audio buffer.
62 int buffer_capacity_;
63 uint8* buffer_;
scherkus (not reviewing) 2011/11/23 01:40:22 scoped_array<uint8> buffer_ this way it'll delete
DaleCurtis 2011/11/23 02:30:06 Done.
64
58 DISALLOW_COPY_AND_ASSIGN(ReferenceAudioRenderer); 65 DISALLOW_COPY_AND_ASSIGN(ReferenceAudioRenderer);
59 }; 66 };
60 67
61 } // namespace media 68 } // namespace media
62 69
63 #endif // MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_ 70 #endif // MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/reference_audio_renderer.cc » ('j') | media/filters/reference_audio_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698