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

Side by Side Diff: media/base/fake_audio_renderer_sink.h

Issue 1184473002: Add support for the audio-output-device switching IPC mechanism to the renderer lower layers (media… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build dependencies for audio_unittests Created 5 years, 6 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
« no previous file with comments | « media/base/audio_renderer_sink.h ('k') | media/base/fake_audio_renderer_sink.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_BASE_FAKE_AUDIO_RENDERER_SINK_H_ 5 #ifndef MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_
6 #define MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ 6 #define MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_
7 7
8 #include <string>
9
8 #include "media/audio/audio_parameters.h" 10 #include "media/audio/audio_parameters.h"
9 #include "media/base/audio_renderer_sink.h" 11 #include "media/base/audio_renderer_sink.h"
10 12
11 namespace media { 13 namespace media {
12 14
13 class FakeAudioRendererSink : public AudioRendererSink { 15 class FakeAudioRendererSink : public AudioRendererSink {
14 public: 16 public:
15 enum State { 17 enum State {
16 kUninitialized, 18 kUninitialized,
17 kInitialized, 19 kInitialized,
18 kStarted, 20 kStarted,
19 kPaused, 21 kPaused,
20 kPlaying, 22 kPlaying,
21 kStopped 23 kStopped
22 }; 24 };
23 25
24 FakeAudioRendererSink(); 26 FakeAudioRendererSink();
25 27
26 void Initialize(const AudioParameters& params, 28 void Initialize(const AudioParameters& params,
27 RenderCallback* callback) override; 29 RenderCallback* callback) override;
28 void Start() override; 30 void Start() override;
29 void Stop() override; 31 void Stop() override;
30 void Pause() override; 32 void Pause() override;
31 void Play() override; 33 void Play() override;
32 bool SetVolume(double volume) override; 34 bool SetVolume(double volume) override;
35 void SwitchOutputDevice(const std::string& device_id,
36 const GURL& security_origin,
37 const SwitchOutputDeviceCB& callback) override;
33 38
34 // Attempts to call Render() on the callback provided to 39 // Attempts to call Render() on the callback provided to
35 // Initialize() with |dest| and |audio_delay_milliseconds|. 40 // Initialize() with |dest| and |audio_delay_milliseconds|.
36 // Returns true and sets |frames_written| to the return value of the 41 // Returns true and sets |frames_written| to the return value of the
37 // Render() call. 42 // Render() call.
38 // Returns false if this object is in a state where calling Render() 43 // Returns false if this object is in a state where calling Render()
39 // should not occur. (i.e., in the kPaused or kStopped state.) The 44 // should not occur. (i.e., in the kPaused or kStopped state.) The
40 // value of |frames_written| is undefined if false is returned. 45 // value of |frames_written| is undefined if false is returned.
41 bool Render(AudioBus* dest, int audio_delay_milliseconds, 46 bool Render(AudioBus* dest, int audio_delay_milliseconds,
42 int* frames_written); 47 int* frames_written);
43 void OnRenderError(); 48 void OnRenderError();
44 49
45 State state() const { return state_; } 50 State state() const { return state_; }
46 51
47 protected: 52 protected:
48 ~FakeAudioRendererSink() override; 53 ~FakeAudioRendererSink() override;
49 54
50 private: 55 private:
51 void ChangeState(State new_state); 56 void ChangeState(State new_state);
52 57
53 State state_; 58 State state_;
54 RenderCallback* callback_; 59 RenderCallback* callback_;
55 60
56 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink); 61 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink);
57 }; 62 };
58 63
59 } // namespace media 64 } // namespace media
60 65
61 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ 66 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_
OLDNEW
« no previous file with comments | « media/base/audio_renderer_sink.h ('k') | media/base/fake_audio_renderer_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698