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

Side by Side Diff: media/gpu/avda_surface_bundle.h

Issue 2692863011: Add ContentVideoViewOverlay to AVDA. (Closed)
Patch Set: fixed avda unittest Created 3 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 unified diff | Download patch
« no previous file with comments | « media/gpu/avda_picture_buffer_manager.cc ('k') | media/gpu/avda_surface_bundle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_ 5 #ifndef MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_
6 #define MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_ 6 #define MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "media/base/android/android_overlay.h"
9 #include "media/base/surface_manager.h" 10 #include "media/base/surface_manager.h"
10 #include "ui/gl/android/scoped_java_surface.h" 11 #include "ui/gl/android/scoped_java_surface.h"
11 #include "ui/gl/android/surface_texture.h" 12 #include "ui/gl/android/surface_texture.h"
12 13
13 namespace media { 14 namespace media {
14 15
15 // AVDASurfaceBundle is a collection of everything that the producer-side of 16 // AVDASurfaceBundle is a collection of everything that the producer-side of
16 // the output surface needs. In other words, it's the surface, and any 17 // the output surface needs. In other words, it's the surface, and any
17 // SurfaceTexture that backs it. The SurfaceTexture isn't needed directly by 18 // SurfaceTexture that backs it. The SurfaceTexture isn't needed directly by
18 // the producer, but destroying it causes the surface not to work. 19 // the producer, but destroying it causes the surface not to work.
19 // 20 //
20 // The idea is that a reference to this should be kept with the codec, even if 21 // The idea is that a reference to this should be kept with the codec, even if
21 // the codec is sent to another thread. This will prevent the output surface 22 // the codec is sent to another thread. This will prevent the output surface
22 // from being destroyed while the codec depends on it. 23 // from being destroyed while the codec depends on it.
23 // While you may send a reference to this to other threads, be sure that it 24 // While you may send a reference to this to other threads, be sure that it
24 // doesn't drop the reference there without creating another one. This has to 25 // doesn't drop the reference there without creating another one. This has to
25 // be destroyed on the gpu main thread. 26 // be destroyed on the gpu main thread.
26 class AVDASurfaceBundle : public base::RefCountedThreadSafe<AVDASurfaceBundle> { 27 class AVDASurfaceBundle : public base::RefCountedThreadSafe<AVDASurfaceBundle> {
27 public: 28 public:
28 explicit AVDASurfaceBundle(int surface_id); 29 explicit AVDASurfaceBundle(int surface_id);
29 30
31 // The surface that MediaCodec is configured to output to. This can be either
32 // a SurfaceTexture or other Surface provider.
33 // TODO(liberato): it would be nice if we had an abstraction that included
34 // SurfaceTexture and Overlay, but we don't right now.
35 const base::android::JavaRef<jobject>& j_surface() const {
36 if (overlay)
37 return overlay->GetJavaSurface();
38 else
39 return surface_texture_surface.j_surface();
40 }
41
30 int surface_id = SurfaceManager::kNoSurfaceID; 42 int surface_id = SurfaceManager::kNoSurfaceID;
31 43
32 // The surface onto which the codec is writing. 44 // The surface onto which the codec is writing.
33 gl::ScopedJavaSurface surface; 45 // TODO(liberato): this isn't true if we have an overlay. the overlay keeps
46 // the java surface.
47 // gl::ScopedJavaSurface surface;
48
49 // If |overlay| is non-null, then |overlay| owns |surface|.
50 std::unique_ptr<AndroidOverlay> overlay;
34 51
35 // The SurfaceTexture attached to |surface|, or nullptr if |surface| is 52 // The SurfaceTexture attached to |surface|, or nullptr if |surface| is
36 // SurfaceView backed. 53 // SurfaceView backed.
37 scoped_refptr<gl::SurfaceTexture> surface_texture; 54 scoped_refptr<gl::SurfaceTexture> surface_texture;
38 55
56 // If |surface_texture| is not null, then this is the surface for it.
57 // TODO(liberato): |surface| is the same thing, since overlays own their own
58 // surfaces anyway.
59 gl::ScopedJavaSurface surface_texture_surface;
60
39 private: 61 private:
40 ~AVDASurfaceBundle(); 62 ~AVDASurfaceBundle();
41 friend class base::RefCountedThreadSafe<AVDASurfaceBundle>; 63 friend class base::RefCountedThreadSafe<AVDASurfaceBundle>;
42 64
43 DISALLOW_COPY_AND_ASSIGN(AVDASurfaceBundle); 65 DISALLOW_COPY_AND_ASSIGN(AVDASurfaceBundle);
44 }; 66 };
45 67
46 } // namespace media 68 } // namespace media
47 69
48 #endif // MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_ 70 #endif // MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_
OLDNEW
« no previous file with comments | « media/gpu/avda_picture_buffer_manager.cc ('k') | media/gpu/avda_surface_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698