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

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: no block 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 d338a4cc343c6b5fef57be40392a8d44f98f81c6..3415608773c19d7ac7c9d773fe42464aee2e3183 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/default_tick_clock.h"
#include "base/time/time.h"
@@ -72,7 +73,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|.
@@ -199,6 +201,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();
@@ -404,28 +409,18 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
// point for when the mailbox was produced.
gpu::Mailbox texture_mailbox_;
- // Stream texture ID allocated to the video.
- unsigned int stream_id_;
-
// Whether the mediaplayer is playing.
bool is_playing_;
// Whether media player needs to re-establish the surface texture peer.
bool needs_establish_peer_;
- // Whether |stream_texture_proxy_| is initialized.
- bool stream_texture_proxy_initialized_;
-
// Whether the video size info is available.
bool has_size_info_;
// Object for allocating stream textures.
scoped_refptr<StreamTextureFactory> stream_texture_factory_;
- // Object for calling back the compositor thread to repaint the video when a
- // frame available. It should be initialized on the compositor thread.
- ScopedStreamTextureProxy stream_texture_proxy_;
-
// Whether media player needs external surface.
// Only used for the VIDEO_HOLE logic.
bool needs_external_surface_;
@@ -433,10 +428,21 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
// Whether valid metadata are available
bool has_valid_metadata_;
+ base::Lock client_lock_;
+
// A pointer back to the compositor to inform it about state changes. This is
// not NULL while the compositor is actively using this webmediaplayer.
+ // Protected by |client_lock_|.
cc::VideoFrameProvider::Client* video_frame_provider_client_;
+ // Object for calling back the compositor thread to repaint the video when a
+ // frame available. It should be initialized on the compositor thread.
+ // Protected by |client_lock_|.
+ ScopedStreamTextureProxy stream_texture_proxy_;
+
+ // Stream texture ID allocated to the video. Protected by |client_lock_|.
+ unsigned int stream_id_;
+
scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_;
#if defined(VIDEO_HOLE)

Powered by Google App Engine
This is Rietveld 408576698