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

Unified Diff: content/browser/renderer_host/media/audio_renderer_host.cc

Issue 11573066: Add a method to tab_utils.h to find out whether a tab is playing audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review/rewrite Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/renderer_host/media/mock_media_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/audio_renderer_host.cc
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc
index 1901e2fb1ebf9b1cfbfe277d65313dcaff60b85a..b4cd34e324e1d36a7af7e811aef2735159d4006c 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.cc
+++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -13,6 +13,8 @@
#include "content/browser/renderer_host/media/audio_mirroring_manager.h"
#include "content/browser/renderer_host/media/audio_sync_reader.h"
#include "content/common/media/audio_messages.h"
+#include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/media_observer.h"
#include "media/audio/shared_memory_util.h"
#include "media/base/audio_bus.h"
#include "media/base/limits.h"
@@ -331,6 +333,9 @@ void AudioRendererHost::OnAssociateStreamWithProducer(int stream_id,
if (entry->render_view_id == render_view_id)
return;
+ // TODO(miu): Merge "AssociateWithProducer" message into "CreateStream"
+ // message so AudioRendererHost can assume a simpler "render_view_id is set
+ // once" scheme. http://crbug.com/166779
if (mirroring_manager_) {
mirroring_manager_->RemoveDiverter(
render_process_id_, entry->render_view_id, entry->controller);
@@ -354,6 +359,13 @@ void AudioRendererHost::OnPlayStream(int stream_id) {
entry->controller->Play();
if (media_internals_)
media_internals_->OnSetAudioStreamPlaying(this, stream_id, true);
+
+ MediaObserver* media_observer =
+ GetContentClient()->browser()->GetMediaObserver();
+ if (media_observer) {
+ media_observer->OnAudioStreamPlayingChanged(
+ render_process_id_, entry->render_view_id, true);
+ }
}
void AudioRendererHost::OnPauseStream(int stream_id) {
@@ -368,6 +380,13 @@ void AudioRendererHost::OnPauseStream(int stream_id) {
entry->controller->Pause();
if (media_internals_)
media_internals_->OnSetAudioStreamPlaying(this, stream_id, false);
+
+ MediaObserver* media_observer =
+ GetContentClient()->browser()->GetMediaObserver();
+ if (media_observer) {
+ media_observer->OnAudioStreamPlayingChanged(
+ render_process_id_, entry->render_view_id, true);
miu 2013/02/05 23:18:25 I think you meant s/true/false/ here.
miu 2013/02/05 23:18:25 Also, note that streams are not necessarily paused
Bernhard Bauer 2013/02/08 16:44:14 Urr, yes. Done.
Bernhard Bauer 2013/02/08 16:44:14 Hm. I changed it to a map from RenderView ID to a
+ }
}
void AudioRendererHost::OnFlushStream(int stream_id) {
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/renderer_host/media/mock_media_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698