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

Side by Side Diff: content/renderer/media/webrtc_audio_renderer.cc

Issue 1323403005: Allow AudioOutputDevice objects to be initialized with a specific hardware output device and store … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Palmer's comments Created 5 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/media/webrtc_audio_renderer.h" 5 #include "content/renderer/media/webrtc_audio_renderer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 int frame_duration_milliseconds = base::Time::kMillisecondsPerSecond / 264 int frame_duration_milliseconds = base::Time::kMillisecondsPerSecond /
265 static_cast<double>(source_params.sample_rate()); 265 static_cast<double>(source_params.sample_rate());
266 fifo_delay_milliseconds_ = (sink_params_.frames_per_buffer() - 266 fifo_delay_milliseconds_ = (sink_params_.frames_per_buffer() -
267 source_params.frames_per_buffer()) * frame_duration_milliseconds; 267 source_params.frames_per_buffer()) * frame_duration_milliseconds;
268 } 268 }
269 } 269 }
270 270
271 source_ = source; 271 source_ = source;
272 272
273 // Configure the audio rendering client and start rendering. 273 // Configure the audio rendering client and start rendering.
274 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_frame_id_);
275
276 DCHECK_GE(session_id_, 0); 274 DCHECK_GE(session_id_, 0);
277 sink_->InitializeWithSessionId(sink_params_, this, session_id_); 275 sink_ = AudioDeviceFactory::NewOutputDevice(
276 source_render_frame_id_, session_id_, std::string(), url::Origin());
277 sink_->Initialize(sink_params_, this);
278 278
279 sink_->Start(); 279 sink_->Start();
280 280
281 // User must call Play() before any audio can be heard. 281 // User must call Play() before any audio can be heard.
282 state_ = PAUSED; 282 state_ = PAUSED;
283 283
284 return true; 284 return true;
285 } 285 }
286 286
287 scoped_refptr<MediaStreamAudioRenderer> 287 scoped_refptr<MediaStreamAudioRenderer>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 if (RemovePlayingState(source, state)) 551 if (RemovePlayingState(source, state))
552 EnterPauseState(); 552 EnterPauseState();
553 } else if (AddPlayingState(source, state)) { 553 } else if (AddPlayingState(source, state)) {
554 EnterPlayState(); 554 EnterPlayState();
555 } 555 }
556 UpdateSourceVolume(source); 556 UpdateSourceVolume(source);
557 } 557 }
558 } 558 }
559 559
560 } // namespace content 560 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698