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

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

Issue 1632793002: Add missing null check to AVDA deferred rendering shutdown path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ran cl format Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 23 matching lines...) Expand all
34 // so that it gets attached in the compositor gl context in the common case. 34 // so that it gets attached in the compositor gl context in the common case.
35 GLuint service_id = 0; 35 GLuint service_id = 0;
36 glGenTextures(1, &service_id); 36 glGenTextures(1, &service_id);
37 DCHECK(service_id); 37 DCHECK(service_id);
38 shared_state_->set_surface_texture_service_id(service_id); 38 shared_state_->set_surface_texture_service_id(service_id);
39 } 39 }
40 40
41 void AndroidDeferredRenderingBackingStrategy::Cleanup( 41 void AndroidDeferredRenderingBackingStrategy::Cleanup(
42 bool have_context, 42 bool have_context,
43 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) { 43 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) {
44 // If we failed before Initialize, then do nothing.
45 if (!shared_state_)
46 return;
47
44 // Make sure that no PictureBuffer textures refer to the SurfaceTexture or to 48 // Make sure that no PictureBuffer textures refer to the SurfaceTexture or to
45 // the service_id that we created for it. 49 // the service_id that we created for it.
46 for (const std::pair<int, media::PictureBuffer>& entry : buffers) 50 for (const std::pair<int, media::PictureBuffer>& entry : buffers)
47 SetImageForPicture(entry.second, nullptr); 51 SetImageForPicture(entry.second, nullptr);
48 52
49 // Now that no AVDACodecImages refer to the SurfaceTexture's texture, delete 53 // Now that no AVDACodecImages refer to the SurfaceTexture's texture, delete
50 // the texture name. 54 // the texture name.
51 GLuint service_id = shared_state_->surface_texture_service_id(); 55 GLuint service_id = shared_state_->surface_texture_service_id();
52 if (service_id > 0 && have_context) 56 if (service_id > 0 && have_context)
53 glDeleteTextures(1, &service_id); 57 glDeleteTextures(1, &service_id);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 avImage->SetMediaCodec(codec); 204 avImage->SetMediaCodec(codec);
201 avImage->SetMediaCodecBufferIndex(-1); 205 avImage->SetMediaCodecBufferIndex(-1);
202 } 206 }
203 } 207 }
204 208
205 void AndroidDeferredRenderingBackingStrategy::OnFrameAvailable() { 209 void AndroidDeferredRenderingBackingStrategy::OnFrameAvailable() {
206 shared_state_->SignalFrameAvailable(); 210 shared_state_->SignalFrameAvailable();
207 } 211 }
208 212
209 } // namespace content 213 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698