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

Unified Diff: content/common/gpu/media/avda_codec_image.h

Issue 1892013002: ReleaseOutputBuffer to surface back and front buffers where possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanerer. Created 4 years, 8 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/common/gpu/media/avda_codec_image.h
diff --git a/content/common/gpu/media/avda_codec_image.h b/content/common/gpu/media/avda_codec_image.h
index 71baf25ce157fd73fe8aaed2dc3d4e19119a81f0..1914fd09c280952d4c1eb67e77d0b855c0630003 100644
--- a/content/common/gpu/media/avda_codec_image.h
+++ b/content/common/gpu/media/avda_codec_image.h
@@ -52,13 +52,23 @@ class AVDACodecImage : public gpu::gles2::GLStreamTextureImage {
// Decoded buffer index that has the image for us to display.
void SetMediaCodecBufferIndex(int buffer_index);
- // Return the codec buffer that we will return to the codec, or
- // <0 if there is no such buffer.
- int GetMediaCodecBufferIndex() const;
-
// Set the size of the current image.
void SetSize(const gfx::Size& size);
+ enum class ReleaseMode { SKIP_RENDER, RENDER_ONLY, RENDER_AND_UPDATE };
liberato (no reviews please) 2016/04/22 00:51:06 i think these might be better named { DISCARD_CODE
DaleCurtis 2016/04/22 01:33:58 I like it. Done.
+ void ReleaseOutputBuffer(ReleaseMode release_mode);
+
+ // Indicates if the codec buffer has been released to the back buffer.
+ bool is_rendered_to_back_buffer() const {
+ return codec_buffer_index_ == kUpdateOnly;
+ }
+
+ // Indicates if the codec buffer has been released to the front or back
+ // buffer.
+ bool is_rendered() const {
+ return codec_buffer_index_ <= kInvalidCodecBufferIndex;
+ }
+
// Updates the MediaCodec for this image; clears |codec_buffer_index_|.
void SetMediaCodec(media::MediaCodecBridge* codec);
@@ -67,9 +77,9 @@ class AVDACodecImage : public gpu::gles2::GLStreamTextureImage {
protected:
~AVDACodecImage() override;
- private:
- enum { kInvalidCodecBufferIndex = -1 };
+ enum { kInvalidCodecBufferIndex = -1, kUpdateOnly = -2 };
+ private:
// Make sure that the surface texture's front buffer is current. This will
// save / restore the current context. It will optionally restore the texture
// bindings in the surface texture's context, based on |mode|. This is

Powered by Google App Engine
This is Rietveld 408576698