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

Unified Diff: content/renderer/media/android/webmediaplayer_android.h

Issue 532993002: work-in-progress patch to fix context lost black video (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/android/webmediaplayer_android.h
diff --git a/content/renderer/media/android/webmediaplayer_android.h b/content/renderer/media/android/webmediaplayer_android.h
index e0bf0a1c984e8892bd1f87d2559e0103b170c030..041522ac1a23e7c56525095e9b3b6cbca9015b77 100644
--- a/content/renderer/media/android/webmediaplayer_android.h
+++ b/content/renderer/media/android/webmediaplayer_android.h
@@ -13,6 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/synchronization/waitable_event.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "cc/layers/video_frame_provider.h"
@@ -70,7 +71,8 @@ class WebContentDecryptionModuleImpl;
// player.
class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
public cc::VideoFrameProvider,
- public RenderFrameObserver {
+ public RenderFrameObserver,
+ public StreamTextureFactoryContextObserver {
public:
// Construct a WebMediaPlayerAndroid object. This class communicates with the
// MediaPlayerAndroid object in the browser process through |proxy|.
@@ -196,6 +198,9 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
void OnMediaPlayerPause();
void OnRequestFullscreen();
+ // StreamTextureFactoryContextObserver implementation.
+ virtual void ResetStreamTextureProxy() OVERRIDE;
+
// Called when the player is released.
virtual void OnPlayerReleased();
@@ -282,6 +287,8 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
void DrawRemotePlaybackText(const std::string& remote_playback_message);
void ReallocateVideoFrame();
void SetCurrentFrameInternal(scoped_refptr<media::VideoFrame>& frame);
+ void BindStreamTextureProxyOnCompositorThread(
+ base::WaitableEvent* completion);
void DidLoadMediaInfo(MediaInfoLoader::Status status,
const GURL& redirected_url,
const GURL& first_party_for_cookies,
@@ -411,6 +418,8 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
bool needs_establish_peer_;
// Whether |stream_texture_proxy_| is initialized.
+ // Accessed on main thread and on compositor thread when main thread is
+ // blocked.
bool stream_texture_proxy_initialized_;
// Whether the video size info is available.
@@ -421,6 +430,8 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
// Object for calling back the compositor thread to repaint the video when a
// frame available. It should be initialized on the compositor thread.
+ // Accessed on main thread and on compositor thread when main thread is
+ // blocked.
ScopedStreamTextureProxy stream_texture_proxy_;
// Whether media player needs external surface.
@@ -432,6 +443,8 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
// A pointer back to the compositor to inform it about state changes. This is
// not NULL while the compositor is actively using this webmediaplayer.
+ // Accessed on main thread and on compositor thread when main thread is
+ // blocked.
cc::VideoFrameProvider::Client* video_frame_provider_client_;
scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_;

Powered by Google App Engine
This is Rietveld 408576698