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

Unified Diff: media/gpu/avda_shared_state.h

Issue 1924973004: Avoid waiting on the SurfaceTexture until we need to. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix. 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
« no previous file with comments | « media/gpu/avda_codec_image.cc ('k') | media/gpu/avda_shared_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/avda_shared_state.h
diff --git a/media/gpu/avda_shared_state.h b/media/gpu/avda_shared_state.h
index c1e01a1f77895aa0ab130432d2971abb50b986c9..f0af97155bb99688f2547bd959b2427068cd3320 100644
--- a/media/gpu/avda_shared_state.h
+++ b/media/gpu/avda_shared_state.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
-#define CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
+#ifndef MEDIA_GPU_AVDA_SHARED_STATE_H_
+#define MEDIA_GPU_AVDA_SHARED_STATE_H_
#include "base/synchronization/waitable_event.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
@@ -77,6 +77,26 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
// will cause us to forget the last binding.
void DidDetachSurfaceTexture();
+ // Helper method for coordinating the interactions between
+ // MediaCodec::ReleaseOutputBuffer() and WaitForFrameAvailable() when
+ // rendering to a SurfaceTexture; this method should never be called when
+ // rendering to a SurfaceView.
+ //
+ // The release of the codec buffer to the surface texture is asynchronous, by
+ // using this helper we can attempt to let this process complete in a non
+ // blocking fashion before the SurfaceTexture is used.
+ //
+ // Clients should call this method to release the codec buffer for rendering
+ // and then call WaitForFrameAvailable() before using the SurfaceTexture. In
+ // the ideal case the SurfaceTexture has already been updated, otherwise the
+ // method will wait for a pro-rated amount of time based on elapsed time up
+ // to a short deadline.
+ //
+ // Some devices do not reliably notify frame availability, so we use a very
+ // short deadline of only a few milliseconds to avoid indefinite stalls.
+ void RenderCodecBufferToSurfaceTexture(media::MediaCodecBridge* codec,
+ int codec_buffer_index);
+
protected:
virtual ~AVDASharedState();
@@ -102,9 +122,14 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
// Maps a picture buffer id to a AVDACodecImage.
std::map<int, AVDACodecImage*> codec_images_;
+ // The time of the last call to RenderCodecBufferToSurfaceTexture(), null if
+ // if there has been no last call or WaitForFrameAvailable() has been called
+ // since the last call.
+ base::TimeTicks release_time_;
+
DISALLOW_COPY_AND_ASSIGN(AVDASharedState);
};
} // namespace media
-#endif // CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
+#endif // MEDIA_GPU_AVDA_SHARED_STATE_H_
« no previous file with comments | « media/gpu/avda_codec_image.cc ('k') | media/gpu/avda_shared_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698