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

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

Issue 10009037: Chrome 18 specific fix for fixing HTML5 audio output on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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/audio_device.h" 5 #include "content/renderer/media/audio_device.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // this class. 88 // this class.
89 CHECK_EQ(0, stream_id_); 89 CHECK_EQ(0, stream_id_);
90 for (int i = 0; i < channels_; ++i) 90 for (int i = 0; i < channels_; ++i)
91 delete [] audio_data_[i]; 91 delete [] audio_data_[i];
92 } 92 }
93 93
94 void AudioDevice::Start() { 94 void AudioDevice::Start() {
95 AudioParameters params; 95 AudioParameters params;
96 params.format = latency_format_; 96 params.format = latency_format_;
97 params.channels = channels_; 97 params.channels = channels_;
98
99 // Chrome 18 specific fix for http://crbug.com/109441 where we determine the
100 // ChannelLayout based on |channels_| but only up to stereo. The proper fix
101 // was committed as r128054 in time for Chrome 19 but it's not suitable for
102 // merging.
103 //
104 // NOTE: surround sound will still be broken but that's something we'll have
105 // to live with until Chrome 19.
106 if (channels_ == 1) {
107 params.channel_layout = CHANNEL_LAYOUT_MONO;
108 } else if (channels_ == 2) {
109 params.channel_layout = CHANNEL_LAYOUT_STEREO;
110 } else {
111 params.channel_layout = CHANNEL_LAYOUT_NONE;
112 }
113
98 params.sample_rate = static_cast<int>(sample_rate_); 114 params.sample_rate = static_cast<int>(sample_rate_);
99 params.bits_per_sample = bits_per_sample_; 115 params.bits_per_sample = bits_per_sample_;
100 params.samples_per_packet = buffer_size_; 116 params.samples_per_packet = buffer_size_;
101 117
102 ChildProcess::current()->io_message_loop()->PostTask( 118 ChildProcess::current()->io_message_loop()->PostTask(
103 FROM_HERE, 119 FROM_HERE,
104 base::Bind(&AudioDevice::InitializeOnIOThread, this, params)); 120 base::Bind(&AudioDevice::InitializeOnIOThread, this, params));
105 } 121 }
106 122
107 void AudioDevice::Stop() { 123 void AudioDevice::Stop() {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // audio thread. 346 // audio thread.
331 audio_socket_->Close(); 347 audio_socket_->Close();
332 audio_thread_->Join(); 348 audio_thread_->Join();
333 // Make sure not to release the socket pointer until after the thread 349 // Make sure not to release the socket pointer until after the thread
334 // has exited. Otherwise there's a race between startup of the thread 350 // has exited. Otherwise there's a race between startup of the thread
335 // and this. 351 // and this.
336 audio_socket_ = NULL; 352 audio_socket_ = NULL;
337 audio_thread_.reset(NULL); 353 audio_thread_.reset(NULL);
338 } 354 }
339 } 355 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698