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

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

Issue 1122393004: Add support for switching the audio output device for HTMLMediaElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to MediaPlayers so that they invoke callbacks in the correct threads. First complete implem… 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
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 #include "media/base/fake_audio_renderer_sink.h" 5 #include "media/base/fake_audio_renderer_sink.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void FakeAudioRendererSink::Play() { 45 void FakeAudioRendererSink::Play() {
46 DCHECK(state_ == kStarted || state_ == kPaused) << "state_ " << state_; 46 DCHECK(state_ == kStarted || state_ == kPaused) << "state_ " << state_;
47 DCHECK_EQ(state_, kPaused); 47 DCHECK_EQ(state_, kPaused);
48 ChangeState(kPlaying); 48 ChangeState(kPlaying);
49 } 49 }
50 50
51 bool FakeAudioRendererSink::SetVolume(double volume) { 51 bool FakeAudioRendererSink::SetVolume(double volume) {
52 return true; 52 return true;
53 } 53 }
54 54
55 void FakeAudioRendererSink::SwitchOutputDevice(
56 const std::string& device_id,
57 const GURL& security_origin,
58 const base::Callback<void(int)>& callback) { }
miu 2015/06/03 21:01:01 ditto: Run the callback to "fake" that something h
59
60
55 bool FakeAudioRendererSink::Render(AudioBus* dest, int audio_delay_milliseconds, 61 bool FakeAudioRendererSink::Render(AudioBus* dest, int audio_delay_milliseconds,
56 int* frames_written) { 62 int* frames_written) {
57 if (state_ != kPlaying) 63 if (state_ != kPlaying)
58 return false; 64 return false;
59 65
60 *frames_written = callback_->Render(dest, audio_delay_milliseconds); 66 *frames_written = callback_->Render(dest, audio_delay_milliseconds);
61 return true; 67 return true;
62 } 68 }
63 69
64 void FakeAudioRendererSink::OnRenderError() { 70 void FakeAudioRendererSink::OnRenderError() {
(...skipping 12 matching lines...) Expand all
77 "kPlaying", 83 "kPlaying",
78 "kStopped" 84 "kStopped"
79 }; 85 };
80 86
81 DVLOG(1) << __FUNCTION__ << " : " 87 DVLOG(1) << __FUNCTION__ << " : "
82 << kStateNames[state_] << " -> " << kStateNames[new_state]; 88 << kStateNames[state_] << " -> " << kStateNames[new_state];
83 state_ = new_state; 89 state_ = new_state;
84 } 90 }
85 91
86 } // namespace media 92 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698