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

Unified Diff: media/gpu/avda_codec_image.cc

Issue 1939943002: Increase cases where back/front buffering early rendering occur. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fast_release
Patch Set: Fix front index calculation. 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.h ('k') | no next file » | 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 e511d09c62ec9ae447041b79706dbc926e853898..d99400eb7e92be1df3aa50c124335206dbf994e0 100644
--- a/media/gpu/avda_codec_image.cc
+++ b/media/gpu/avda_codec_image.cc
@@ -125,7 +125,7 @@ void AVDACodecImage::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
void AVDACodecImage::UpdateSurfaceTexture(RestoreBindingsMode mode) {
DCHECK(surface_texture_);
DCHECK_EQ(codec_buffer_index_, kUpdateOnly);
- codec_buffer_index_ = kInvalidCodecBufferIndex;
+ codec_buffer_index_ = kRendered;
// Swap the rendered image to the front.
std::unique_ptr<ui::ScopedMakeCurrent> scoped_make_current =
@@ -149,14 +149,6 @@ void AVDACodecImage::UpdateSurfaceTexture(RestoreBindingsMode mode) {
surface_texture_->GetTransformMatrix(gl_matrix_);
}
-void AVDACodecImage::SetMediaCodecBufferIndex(int buffer_index) {
- codec_buffer_index_ = buffer_index;
-}
-
-void AVDACodecImage::SetSize(const gfx::Size& size) {
- size_ = size;
-}
-
void AVDACodecImage::UpdateSurface(UpdateMode update_mode) {
UpdateSurfaceInternal(update_mode, kDoRestoreBindings);
}
@@ -166,10 +158,6 @@ void AVDACodecImage::CodecChanged(media::MediaCodecBridge* codec) {
codec_buffer_index_ = kInvalidCodecBufferIndex;
}
-void AVDACodecImage::SetTexture(gpu::gles2::Texture* texture) {
- texture_ = texture;
-}
-
void AVDACodecImage::UpdateSurfaceInternal(
UpdateMode update_mode,
RestoreBindingsMode attached_bindings_mode) {
@@ -217,6 +205,9 @@ void AVDACodecImage::ReleaseOutputBuffer(UpdateMode update_mode) {
if (update_mode == UpdateMode::DISCARD_CODEC_BUFFER) {
if (codec_buffer_index_ != kUpdateOnly)
media_codec_->ReleaseOutputBuffer(codec_buffer_index_, false);
+
+ // Note: No need to wait for the frame to be available in the kUpdateOnly
+ // case since it will be or has been waited on by another release call.
codec_buffer_index_ = kInvalidCodecBufferIndex;
return;
}
@@ -228,7 +219,7 @@ void AVDACodecImage::ReleaseOutputBuffer(UpdateMode update_mode) {
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;
+ codec_buffer_index_ = kRendered;
return;
}
@@ -285,7 +276,10 @@ void AVDACodecImage::GetTextureMatrix(float matrix[16]) {
}
bool AVDACodecImage::IsCodecBufferOutstanding() const {
- return codec_buffer_index_ != kInvalidCodecBufferIndex && media_codec_;
+ static_assert(kUpdateOnly < 0 && kUpdateOnly > kRendered &&
+ kRendered > kInvalidCodecBufferIndex,
+ "Codec buffer index enum values are not ordered correctly.");
+ return codec_buffer_index_ > kRendered && media_codec_;
}
} // namespace media
« no previous file with comments | « media/gpu/avda_codec_image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698