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

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: Fix compile warning. 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
« no previous file with comments | « no previous file | media/filters/reference_audio_renderer.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) 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/content/renderer/media/audio_renderer_impl.h for chrome's
15 // implementation. 15 // implementation.
16 16
17 #include <deque> 17 #include "media/audio/audio_output_controller.h"
18
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" 18 #include "media/filters/audio_renderer_base.h"
23 19
24 namespace media { 20 namespace media {
25 21
26 class MEDIA_EXPORT ReferenceAudioRenderer 22 class MEDIA_EXPORT ReferenceAudioRenderer
27 : public AudioRendererBase, 23 : public AudioRendererBase,
28 public AudioOutputStream::AudioSourceCallback { 24 public AudioOutputController::EventHandler {
29 public: 25 public:
30 ReferenceAudioRenderer(); 26 ReferenceAudioRenderer();
31 virtual ~ReferenceAudioRenderer(); 27 virtual ~ReferenceAudioRenderer();
32 28
33 // Filter implementation. 29 // Filter implementation.
34 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; 30 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
35 31
36 // AudioRenderer implementation. 32 // AudioRenderer implementation.
37 virtual void SetVolume(float volume) OVERRIDE; 33 virtual void SetVolume(float volume) OVERRIDE;
38 34
39 // AudioSourceCallback implementation. 35 // AudioController::EventHandler implementation.
40 virtual uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, 36 virtual void OnCreated(AudioOutputController* controller) OVERRIDE;
41 uint32 len, 37 virtual void OnPlaying(AudioOutputController* controller) OVERRIDE;
42 AudioBuffersState buffers_state) OVERRIDE; 38 virtual void OnPaused(AudioOutputController* controller) OVERRIDE;
43 virtual void OnClose(AudioOutputStream* stream); 39 virtual void OnError(AudioOutputController* controller,
44 virtual void OnError(AudioOutputStream* stream, int code) OVERRIDE; 40 int error_code) OVERRIDE;
41 virtual void OnMoreData(AudioOutputController* controller,
42 AudioBuffersState buffers_state) OVERRIDE;
45 43
46 protected: 44 protected:
47 // AudioRendererBase implementation. 45 // AudioRendererBase implementation.
48 virtual bool OnInitialize(int bits_per_channel, 46 virtual bool OnInitialize(int bits_per_channel,
49 ChannelLayout channel_layout, 47 ChannelLayout channel_layout,
50 int sample_rate) OVERRIDE; 48 int sample_rate) OVERRIDE;
51 virtual void OnStop() OVERRIDE; 49 virtual void OnStop() OVERRIDE;
52 50
53 private: 51 private:
54 // Audio output stream device.
55 AudioOutputStream* stream_;
56 int bytes_per_second_; 52 int bytes_per_second_;
57 53
54 // AudioOutputController::Close callback.
55 virtual void OnClose();
56
57 // Audio output controller.
58 scoped_refptr<media::AudioOutputController> controller_;
59
60 // Audio buffer.
61 int buffer_capacity_;
62 scoped_array<uint8> buffer_;
63
58 DISALLOW_COPY_AND_ASSIGN(ReferenceAudioRenderer); 64 DISALLOW_COPY_AND_ASSIGN(ReferenceAudioRenderer);
59 }; 65 };
60 66
61 } // namespace media 67 } // namespace media
62 68
63 #endif // MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_ 69 #endif // MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/reference_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698