OLD | NEW |
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/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 AudioRendererHost::AudioEntry::AudioEntry() | 22 AudioRendererHost::AudioEntry::AudioEntry() |
23 : stream_id(0), | 23 : stream_id(0), |
24 pending_close(false) { | 24 pending_close(false) { |
25 } | 25 } |
26 | 26 |
27 AudioRendererHost::AudioEntry::~AudioEntry() {} | 27 AudioRendererHost::AudioEntry::~AudioEntry() {} |
28 | 28 |
29 /////////////////////////////////////////////////////////////////////////////// | 29 /////////////////////////////////////////////////////////////////////////////// |
30 // AudioRendererHost implementations. | 30 // AudioRendererHost implementations. |
31 AudioRendererHost::AudioRendererHost( | 31 AudioRendererHost::AudioRendererHost( |
32 const content::ResourceContext* resource_context) | 32 content::ResourceContext* resource_context) |
33 : resource_context_(resource_context), | 33 : resource_context_(resource_context), |
34 media_observer_(NULL) { | 34 media_observer_(NULL) { |
35 } | 35 } |
36 | 36 |
37 AudioRendererHost::~AudioRendererHost() { | 37 AudioRendererHost::~AudioRendererHost() { |
38 DCHECK(audio_entries_.empty()); | 38 DCHECK(audio_entries_.empty()); |
39 } | 39 } |
40 | 40 |
41 void AudioRendererHost::OnChannelClosing() { | 41 void AudioRendererHost::OnChannelClosing() { |
42 BrowserMessageFilter::OnChannelClosing(); | 42 BrowserMessageFilter::OnChannelClosing(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 if (!reader->Init()) { | 223 if (!reader->Init()) { |
224 SendErrorMessage(stream_id); | 224 SendErrorMessage(stream_id); |
225 return; | 225 return; |
226 } | 226 } |
227 | 227 |
228 // If we have successfully created the SyncReader then assign it to the | 228 // If we have successfully created the SyncReader then assign it to the |
229 // entry and construct an AudioOutputController. | 229 // entry and construct an AudioOutputController. |
230 entry->reader.reset(reader.release()); | 230 entry->reader.reset(reader.release()); |
231 entry->controller = media::AudioOutputController::Create( | 231 entry->controller = media::AudioOutputController::Create( |
232 resource_context_->audio_manager(), this, audio_params, | 232 resource_context_->GetAudioManager(), this, audio_params, |
233 entry->reader.get()); | 233 entry->reader.get()); |
234 | 234 |
235 if (!entry->controller) { | 235 if (!entry->controller) { |
236 SendErrorMessage(stream_id); | 236 SendErrorMessage(stream_id); |
237 return; | 237 return; |
238 } | 238 } |
239 | 239 |
240 // If we have created the controller successfully, create an entry and add it | 240 // If we have created the controller successfully, create an entry and add it |
241 // to the map. | 241 // to the map. |
242 entry->stream_id = stream_id; | 242 entry->stream_id = stream_id; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 i != audio_entries_.end(); ++i) { | 384 i != audio_entries_.end(); ++i) { |
385 if (!i->second->pending_close && controller == i->second->controller.get()) | 385 if (!i->second->pending_close && controller == i->second->controller.get()) |
386 return i->second; | 386 return i->second; |
387 } | 387 } |
388 return NULL; | 388 return NULL; |
389 } | 389 } |
390 | 390 |
391 MediaObserver* AudioRendererHost::media_observer() { | 391 MediaObserver* AudioRendererHost::media_observer() { |
392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
393 if (!media_observer_) | 393 if (!media_observer_) |
394 media_observer_ = resource_context_->media_observer(); | 394 media_observer_ = resource_context_->GetMediaObserver(); |
395 return media_observer_; | 395 return media_observer_; |
396 } | 396 } |
OLD | NEW |