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

Side by Side Diff: content/common/gpu/media/android_deferred_rendering_backing_strategy.cc

Issue 1862303002: Delay actual flush and reset in AVDA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Kept OUTPUT_FORMAT_CHANGED processing while draining, rebased 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h " 5 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h "
6 6
7 #include <EGL/egl.h> 7 #include <EGL/egl.h>
8 #include <EGL/eglext.h> 8 #include <EGL/eglext.h>
9 9
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void AndroidDeferredRenderingBackingStrategy::Cleanup( 73 void AndroidDeferredRenderingBackingStrategy::Cleanup(
74 bool have_context, 74 bool have_context,
75 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) { 75 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) {
76 // If we failed before Initialize, then do nothing. 76 // If we failed before Initialize, then do nothing.
77 if (!shared_state_) 77 if (!shared_state_)
78 return; 78 return;
79 79
80 // Make sure that no PictureBuffer textures refer to the SurfaceTexture or to 80 // Make sure that no PictureBuffer textures refer to the SurfaceTexture or to
81 // the service_id that we created for it. 81 // the service_id that we created for it.
82 for (const std::pair<int, media::PictureBuffer>& entry : buffers) 82 for (const std::pair<int, media::PictureBuffer>& entry : buffers) {
83 ReleaseCodecBufferForPicture(entry.second);
83 SetImageForPicture(entry.second, nullptr); 84 SetImageForPicture(entry.second, nullptr);
85 }
84 86
85 // If we're rendering to a SurfaceTexture we can make a copy of the current 87 // If we're rendering to a SurfaceTexture we can make a copy of the current
86 // front buffer so that the PictureBuffer textures are still valid. 88 // front buffer so that the PictureBuffer textures are still valid.
87 if (surface_texture_ && have_context && ShouldCopyPictures()) 89 if (surface_texture_ && have_context && ShouldCopyPictures())
88 CopySurfaceTextureToPictures(buffers); 90 CopySurfaceTextureToPictures(buffers);
89 91
90 // Now that no AVDACodecImages refer to the SurfaceTexture's texture, delete 92 // Now that no AVDACodecImages refer to the SurfaceTexture's texture, delete
91 // the texture name. 93 // the texture name.
92 GLuint service_id = shared_state_->surface_texture_service_id(); 94 GLuint service_id = shared_state_->surface_texture_service_id();
93 if (service_id > 0 && have_context) 95 if (service_id > 0 && have_context)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 GL_RGBA, GL_UNSIGNED_BYTE, rgba); 212 GL_RGBA, GL_UNSIGNED_BYTE, rgba);
211 } 213 }
212 } 214 }
213 215
214 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture( 216 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture(
215 const media::PictureBuffer& picture_buffer) { 217 const media::PictureBuffer& picture_buffer) {
216 AVDACodecImage* avda_image = 218 AVDACodecImage* avda_image =
217 shared_state_->GetImageForPicture(picture_buffer.id()); 219 shared_state_->GetImageForPicture(picture_buffer.id());
218 RETURN_IF_NULL(avda_image); 220 RETURN_IF_NULL(avda_image);
219 221
222 if (!avda_image)
223 return;
224
220 // See if there is a media codec buffer still attached to this image. 225 // See if there is a media codec buffer still attached to this image.
221 const int32_t codec_buffer = avda_image->GetMediaCodecBufferIndex(); 226 const int32_t codec_buffer = avda_image->GetMediaCodecBufferIndex();
222 227
223 if (codec_buffer >= 0) { 228 if (codec_buffer >= 0) {
224 // PictureBuffer wasn't displayed, so release the buffer. 229 // PictureBuffer wasn't displayed, so release the buffer.
225 media_codec_->ReleaseOutputBuffer(codec_buffer, false); 230 media_codec_->ReleaseOutputBuffer(codec_buffer, false);
226 avda_image->SetMediaCodecBufferIndex(-1); 231 avda_image->SetMediaCodecBufferIndex(-1);
227 } 232 }
228 } 233 }
229 234
230 void AndroidDeferredRenderingBackingStrategy::ReuseOnePictureBuffer( 235 void AndroidDeferredRenderingBackingStrategy::ReuseOnePictureBuffer(
231 const media::PictureBuffer& picture_buffer) { 236 const media::PictureBuffer& picture_buffer) {
232 // At this point, the CC must be done with the picture. We can't really 237 // At this point, the CC must be done with the picture. We can't really
233 // check for that here directly. it's guaranteed in gpu_video_decoder.cc, 238 // check for that here directly. it's guaranteed in gpu_video_decoder.cc,
234 // when it waits on the sync point before releasing the mailbox. That sync 239 // when it waits on the sync point before releasing the mailbox. That sync
235 // point is inserted by destroying the resource in VideoLayerImpl::DidDraw. 240 // point is inserted by destroying the resource in VideoLayerImpl::DidDraw.
236 ReleaseCodecBufferForPicture(picture_buffer); 241 ReleaseCodecBufferForPicture(picture_buffer);
237 } 242 }
238 243
244 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBuffers(
245 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) {
246 for (const std::pair<int, media::PictureBuffer>& entry : buffers)
247 ReleaseCodecBufferForPicture(entry.second);
248 }
249
239 void AndroidDeferredRenderingBackingStrategy::CodecChanged( 250 void AndroidDeferredRenderingBackingStrategy::CodecChanged(
240 media::VideoCodecBridge* codec) { 251 media::VideoCodecBridge* codec) {
241 media_codec_ = codec; 252 media_codec_ = codec;
242 shared_state_->CodecChanged(codec); 253 shared_state_->CodecChanged(codec);
243 } 254 }
244 255
245 void AndroidDeferredRenderingBackingStrategy::OnFrameAvailable() { 256 void AndroidDeferredRenderingBackingStrategy::OnFrameAvailable() {
246 shared_state_->SignalFrameAvailable(); 257 shared_state_->SignalFrameAvailable();
247 } 258 }
248 259
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 return !feature_info->workarounds().avda_dont_copy_pictures; 392 return !feature_info->workarounds().avda_dont_copy_pictures;
382 } 393 }
383 } 394 }
384 } 395 }
385 396
386 // Assume so. 397 // Assume so.
387 return true; 398 return true;
388 } 399 }
389 400
390 } // namespace content 401 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698