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

Side by Side Diff: content/renderer/media/android/stream_texture_factory_synchronous_impl.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: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H _ 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H _
6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H _ 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H _
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/observer_list.h"
10 #include "content/renderer/media/android/stream_texture_factory.h" 11 #include "content/renderer/media/android/stream_texture_factory.h"
11 12
12 namespace gfx { 13 namespace gfx {
13 class SurfaceTexture; 14 class SurfaceTexture;
14 } 15 }
15 16
16 namespace gpu { 17 namespace gpu {
17 namespace gles2 { 18 namespace gles2 {
18 class GLES2Interface; 19 class GLES2Interface;
19 } // namespace gles2 20 } // namespace gles2
20 } // namespace gpu 21 } // namespace gpu
21 22
22 namespace content { 23 namespace content {
23 24
24 // Factory for when using synchronous compositor in Android WebView. 25 // Factory for when using synchronous compositor in Android WebView.
25 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { 26 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory {
26 public: 27 public:
27 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { 28 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
28 public: 29 public:
29 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( 30 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
30 uint32 stream_id) = 0; 31 uint32 stream_id) = 0;
31 32
32 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; 33 virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
33 34
35 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0;
36 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0;
37
34 protected: 38 protected:
35 friend class base::RefCountedThreadSafe<ContextProvider>; 39 friend class base::RefCountedThreadSafe<ContextProvider>;
36 virtual ~ContextProvider() {} 40 virtual ~ContextProvider() {}
37 }; 41 };
38 42
39 typedef base::Callback<scoped_refptr<ContextProvider>(void)> 43 typedef base::Callback<scoped_refptr<ContextProvider>(void)>
40 CreateContextProviderCallback; 44 CreateContextProviderCallback;
41 45
42 static scoped_refptr<StreamTextureFactorySynchronousImpl> Create( 46 static scoped_refptr<StreamTextureFactorySynchronousImpl> Create(
43 const CreateContextProviderCallback& try_create_callback, 47 const CreateContextProviderCallback& try_create_callback,
44 int frame_id); 48 int frame_id);
45 49
46 virtual StreamTextureProxy* CreateProxy() OVERRIDE; 50 virtual StreamTextureProxy* CreateProxy() OVERRIDE;
47 virtual void EstablishPeer(int32 stream_id, int player_id) OVERRIDE; 51 virtual void EstablishPeer(int32 stream_id, int player_id) OVERRIDE;
48 virtual unsigned CreateStreamTexture(unsigned texture_target, 52 virtual unsigned CreateStreamTexture(unsigned texture_target,
49 unsigned* texture_id, 53 unsigned* texture_id,
50 gpu::Mailbox* texture_mailbox) OVERRIDE; 54 gpu::Mailbox* texture_mailbox) OVERRIDE;
51 virtual void SetStreamTextureSize(int32 stream_id, 55 virtual void SetStreamTextureSize(int32 stream_id,
52 const gfx::Size& size) OVERRIDE; 56 const gfx::Size& size) OVERRIDE;
53 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; 57 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
58 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) OVERRIDE;
59 virtual void RemoveObserver(
60 StreamTextureFactoryContextObserver* obs) OVERRIDE;
54 61
55 private: 62 private:
56 friend class base::RefCounted<StreamTextureFactorySynchronousImpl>; 63 friend class base::RefCounted<StreamTextureFactorySynchronousImpl>;
57 StreamTextureFactorySynchronousImpl( 64 StreamTextureFactorySynchronousImpl(
58 const CreateContextProviderCallback& try_create_callback, 65 const CreateContextProviderCallback& try_create_callback,
59 int frame_id); 66 int frame_id);
60 virtual ~StreamTextureFactorySynchronousImpl(); 67 virtual ~StreamTextureFactorySynchronousImpl();
61 68
62 CreateContextProviderCallback create_context_provider_callback_; 69 CreateContextProviderCallback create_context_provider_callback_;
63 scoped_refptr<ContextProvider> context_provider_; 70 scoped_refptr<ContextProvider> context_provider_;
64 int frame_id_; 71 int frame_id_;
72 StreamTextureFactoryContextObserver* observer_;
65 73
66 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactorySynchronousImpl); 74 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactorySynchronousImpl);
67 }; 75 };
68 76
69 } // namespace content 77 } // namespace content
70 78
71 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMP L_H_ 79 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMP L_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698