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

Unified Diff: media/gpu/avda_codec_image.cc

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 | « no previous file | media/gpu/avda_shared_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/avda_codec_image.cc
diff --git a/media/gpu/avda_codec_image.cc b/media/gpu/avda_codec_image.cc
index 8fdb6f54a29e1de94ff9b16ff0f2d35f858e8814..e511d09c62ec9ae447041b79706dbc926e853898 100644
--- a/media/gpu/avda_codec_image.cc
+++ b/media/gpu/avda_codec_image.cc
@@ -8,7 +8,6 @@
#include <memory>
-#include "base/metrics/histogram_macros.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
@@ -225,22 +224,27 @@ void AVDACodecImage::ReleaseOutputBuffer(UpdateMode update_mode) {
DCHECK(update_mode == UpdateMode::RENDER_TO_BACK_BUFFER ||
update_mode == UpdateMode::RENDER_TO_FRONT_BUFFER);
- // If we've already released to the back buffer, there's nothing left to do.
- if (codec_buffer_index_ == kUpdateOnly)
- return;
-
- media_codec_->ReleaseOutputBuffer(codec_buffer_index_, true);
- codec_buffer_index_ = kUpdateOnly;
-
- // If we're using a SurfaceView we're done!
if (!surface_texture_) {
+ DCHECK(update_mode == UpdateMode::RENDER_TO_FRONT_BUFFER);
+ DCHECK_GE(codec_buffer_index_, 0);
+ media_codec_->ReleaseOutputBuffer(codec_buffer_index_, true);
codec_buffer_index_ = kInvalidCodecBufferIndex;
return;
}
- // This must be synchronous, so wait for OnFrameAvailable.
- SCOPED_UMA_HISTOGRAM_TIMER("Media.AvdaCodecImage.WaitTimeForFrame");
- shared_state_->WaitForFrameAvailable();
+ // If we've already released to the back buffer, there's nothing left to do,
+ // but wait for the previously released buffer if necessary.
+ if (codec_buffer_index_ != kUpdateOnly) {
+ DCHECK(surface_texture_);
+ DCHECK_GE(codec_buffer_index_, 0);
+ shared_state_->RenderCodecBufferToSurfaceTexture(media_codec_,
+ codec_buffer_index_);
+ codec_buffer_index_ = kUpdateOnly;
+ }
+
+ // Only wait for the SurfaceTexture update if we're rendering to the front.
+ if (update_mode == UpdateMode::RENDER_TO_FRONT_BUFFER)
+ shared_state_->WaitForFrameAvailable();
}
void AVDACodecImage::AttachSurfaceTextureToContext() {
« no previous file with comments | « no previous file | media/gpu/avda_shared_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698