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

Side by Side Diff: content/browser/media/android/browser_surface_view_manager.h

Issue 2567233002: Use GVR async reprojection video surface for fullscreen in VR shell
Patch Set: Refactor using new interface and manager, also rebased Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BROWSER_MEDIA_ANDROID_BROWSER_SURFACE_VIEW_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_SURFACE_VIEW_MANAGER_H_
6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_SURFACE_VIEW_MANAGER_H_ 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_SURFACE_VIEW_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/browser/android/content_video_view.h"
14 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/android/video_surface_manager.h"
15 #include "content/public/browser/android/video_surface_provider.h"
15 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 class RenderFrameHost; 20 class RenderFrameHost;
20 21
21 // BrowserSurfaceViewManager creates and owns a ContentVideoView on behalf of 22 // BrowserSurfaceViewManager creates and owns a ContentVideoView on behalf of
22 // a fullscreen media player. Its SurfaceView is registered so that a decoder 23 // a fullscreen media player. Its SurfaceView is registered so that a decoder
23 // in the GPU process can look it up and render to it. 24 // in the GPU process can look it up and render to it.
24 class CONTENT_EXPORT BrowserSurfaceViewManager 25 class CONTENT_EXPORT BrowserSurfaceViewManager
25 : public ContentVideoView::Client { 26 : public VideoSurfaceProvider::Client {
26 public: 27 public:
27 explicit BrowserSurfaceViewManager(RenderFrameHost* render_frame_host); 28 explicit BrowserSurfaceViewManager(RenderFrameHost* render_frame_host);
28 ~BrowserSurfaceViewManager(); 29 ~BrowserSurfaceViewManager();
29 30
30 // ContentVideoView::Client overrides. 31 // VideoSurfaceProvider::Client overrides.
31 void SetVideoSurface(gl::ScopedJavaSurface surface) override; 32 void SetVideoSurface(gl::ScopedJavaSurface surface) override;
32 void DidExitFullscreen(bool release_media_player) override; 33 void DidExitFullscreen(bool release_media_player) override;
33 34
34 void OnCreateFullscreenSurface(const gfx::Size& video_natural_size); 35 void OnCreateFullscreenSurface(const gfx::Size& video_natural_size);
35 void OnNaturalSizeChanged(const gfx::Size& size); 36 void OnNaturalSizeChanged(const gfx::Size& size);
36 37
37 private: 38 private:
38 // Send a message to return the surface id to the caller. 39 // Send a message to return the surface id to the caller.
39 bool SendSurfaceID(int surface_id); 40 bool SendSurfaceID(int surface_id);
40 41
41 // Synchronously notify the decoder that the surface is being destroyed so it 42 // Synchronously notify the decoder that the surface is being destroyed so it
42 // can stop rendering to it. This sends a message to the GPU process. Without 43 // can stop rendering to it. This sends a message to the GPU process. Without
43 // this, the MediaCodec decoder will start throwing IllegalStateException, and 44 // this, the MediaCodec decoder will start throwing IllegalStateException, and
44 // crash on some devices (http://crbug.com/598408, http://crbug.com/600454). 45 // crash on some devices (http://crbug.com/598408, http://crbug.com/600454).
45 void SendDestroyingVideoSurface(int surface_id); 46 void SendDestroyingVideoSurface(int surface_id);
46 47
47 RenderFrameHost* const render_frame_host_; 48 RenderFrameHost* const render_frame_host_;
48 49
49 // The surface id of the ContentVideoView surface. 50 VideoSurfaceManager* video_surface_manager_;
51
52 // The surface id of the VideoSurfaceProvider surface.
50 int surface_id_; 53 int surface_id_;
51 54
52 // The fullscreen view that contains a SurfaceView. 55 // The provider for fullscreen video surface.
53 std::unique_ptr<ContentVideoView> content_video_view_; 56 VideoSurfaceProvider* video_surface_provider_;
54 57
55 DISALLOW_COPY_AND_ASSIGN(BrowserSurfaceViewManager); 58 DISALLOW_COPY_AND_ASSIGN(BrowserSurfaceViewManager);
56 }; 59 };
57 60
58 } // namespace content 61 } // namespace content
59 62
60 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_SURFACE_VIEW_MANAGER_H_ 63 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_SURFACE_VIEW_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698