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

Unified Diff: media/gpu/avda_surface_bundle.h

Issue 2707703002: Group AVDA output surface into AVDASurfaceBundle. (Closed)
Patch Set: rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/gpu/avda_codec_allocator.cc ('k') | media/gpu/avda_surface_bundle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/avda_surface_bundle.h
diff --git a/media/gpu/avda_surface_bundle.h b/media/gpu/avda_surface_bundle.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a8e0ce3ccfb5db08f5b510ff7a92798d530c5fb
--- /dev/null
+++ b/media/gpu/avda_surface_bundle.h
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_
+#define MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_
+
+#include "base/memory/ref_counted.h"
+#include "media/base/surface_manager.h"
+#include "ui/gl/android/scoped_java_surface.h"
+#include "ui/gl/android/surface_texture.h"
+
+namespace media {
+
+// AVDASurfaceBundle is a collection of everything that the producer-side of
+// the output surface needs. In other words, it's the surface, and any
+// SurfaceTexture that backs it. The SurfaceTexture isn't needed directly by
+// the producer, but destroying it causes the surface not to work.
+//
+// The idea is that a reference to this should be kept with the codec, even if
+// the codec is sent to another thread. This will prevent the output surface
+// from being destroyed while the codec depends on it.
+// While you may send a reference to this to other threads, be sure that it
+// doesn't drop the reference there without creating another one. This has to
+// be destroyed on the gpu main thread.
+class AVDASurfaceBundle : public base::RefCountedThreadSafe<AVDASurfaceBundle> {
+ public:
+ explicit AVDASurfaceBundle(int surface_id);
+
+ int surface_id = SurfaceManager::kNoSurfaceID;
+
+ // The surface onto which the codec is writing.
+ gl::ScopedJavaSurface surface;
+
+ // The SurfaceTexture attached to |surface|, or nullptr if |surface| is
+ // SurfaceView backed.
+ scoped_refptr<gl::SurfaceTexture> surface_texture;
+
+ private:
+ ~AVDASurfaceBundle();
+ friend class base::RefCountedThreadSafe<AVDASurfaceBundle>;
+
+ DISALLOW_COPY_AND_ASSIGN(AVDASurfaceBundle);
+};
+
+} // namespace media
+
+#endif // MEDIA_GPU_AVDA_SURFACE_BUNDLE_H_
« no previous file with comments | « media/gpu/avda_codec_allocator.cc ('k') | media/gpu/avda_surface_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698