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

Unified Diff: content/browser/android/media_player_manager_android.cc

Issue 12443003: Implement out-of-band video compositing on Android: Step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 9 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
Index: content/browser/android/media_player_manager_android.cc
diff --git a/content/browser/android/media_player_manager_android.cc b/content/browser/android/media_player_manager_android.cc
index 89412c8502b919d35d8e8c786afe7e163b203a11..7375ff72e17aec22f719eb08a94e2ec102cd5f98 100644
--- a/content/browser/android/media_player_manager_android.cc
+++ b/content/browser/android/media_player_manager_android.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "content/browser/android/media_resource_getter_impl.h"
+#include "content/browser/web_contents/web_contents_view_android.h"
#include "content/common/media/media_player_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
@@ -24,7 +25,8 @@ MediaPlayerManagerAndroid::MediaPlayerManagerAndroid(
RenderViewHost* render_view_host)
: RenderViewHostObserver(render_view_host),
ALLOW_THIS_IN_INITIALIZER_LIST(video_view_(this)),
- fullscreen_player_id_(-1) {
+ fullscreen_player_id_(-1),
+ web_contents_(WebContents::FromRenderViewHost(render_view_host)) {
}
MediaPlayerManagerAndroid::~MediaPlayerManagerAndroid() {}
@@ -43,6 +45,8 @@ bool MediaPlayerManagerAndroid::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyMediaPlayer, OnDestroyPlayer)
IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers,
DestroyAllMediaPlayers)
+ IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_RequestExternalSurface,
+ OnRequestExternalSurface)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -199,6 +203,28 @@ void MediaPlayerManagerAndroid::DestroyAllMediaPlayers() {
}
}
+void MediaPlayerManagerAndroid::AttachExternalVideoSurface(int player_id,
+ jobject surface) {
+ MediaPlayerBridge* player = GetPlayer(player_id);
+ if (player)
+ player->SetVideoSurface(surface);
+}
+
+void MediaPlayerManagerAndroid::DetachExternalVideoSurface(int player_id) {
+ MediaPlayerBridge* player = GetPlayer(player_id);
+ if (player)
+ player->SetVideoSurface(NULL);
+}
+
+void MediaPlayerManagerAndroid::OnRequestExternalSurface(int player_id) {
+ if (web_contents_) {
+ WebContentsViewAndroid* view =
+ static_cast<WebContentsViewAndroid*>(web_contents_->GetView());
+ if (view)
+ view->RequestExternalVideoSurface(player_id);
+ }
+}
+
MediaPlayerBridge* MediaPlayerManagerAndroid::GetPlayer(int player_id) {
for (ScopedVector<MediaPlayerBridge>::iterator it = players_.begin();
it != players_.end(); ++it) {
« no previous file with comments | « content/browser/android/media_player_manager_android.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698