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

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

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