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

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

Issue 1750213002: Fix Android black frames from MSE config changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cros build Created 4 years, 9 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_copying_backing_strategy.h" 5 #include "content/common/gpu/media/android_copying_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/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "content/common/gpu/media/avda_return_on_failure.h" 10 #include "content/common/gpu/media/avda_return_on_failure.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // TODO(liberato): crbug.com/574948 . The OnFrameAvailable logic can be 154 // TODO(liberato): crbug.com/574948 . The OnFrameAvailable logic can be
155 // moved into AVDA, and we should wait for it before doing the copy. 155 // moved into AVDA, and we should wait for it before doing the copy.
156 // Because there were some test failures, we don't do this now but 156 // Because there were some test failures, we don't do this now but
157 // instead preserve the old behavior. 157 // instead preserve the old behavior.
158 } 158 }
159 159
160 bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() { 160 bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() {
161 return false; 161 return false;
162 } 162 }
163 163
164 void AndroidCopyingBackingStrategy::UpdatePictureBufferSize(
165 media::PictureBuffer* picture_buffer,
166 const gfx::Size& new_size) {
167 // This strategy uses 2D textures who's allocated memory is dependent on the
168 // size. To update size in all places, we must:
169 // 1) Update the PictureBuffer meta-data
170 picture_buffer->set_size(new_size);
171
172 // 2) Update the GL texture via glTextImage2D. This step assumes the caller
173 // has made our GL context current.
174 glBindTexture(GL_TEXTURE_2D, picture_buffer->texture_id());
175 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, new_size.width(), new_size.height(),
176 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
177 state_provider_->GetGlDecoder()->RestoreActiveTextureUnitBinding(
178 GL_TEXTURE_2D);
179
180 // 3) Update the CHROMIUM Texture's size.
181 gpu::gles2::TextureRef* texture_ref =
182 state_provider_->GetTextureForPicture(*picture_buffer);
183 RETURN_IF_NULL(texture_ref);
184 gpu::gles2::TextureManager* texture_manager =
185 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager();
186 RETURN_IF_NULL(texture_manager);
187 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA,
188 new_size.width(), new_size.height(), 1, 0,
189 GL_RGBA, GL_UNSIGNED_BYTE,
190 gfx::Rect(new_size.width(), new_size.height()));
liberato (no reviews please) 2016/03/07 16:39:16 i think that gfx::Rect(new_size) works.
chcunningham 2016/03/08 03:19:36 Done.
191 }
192
164 } // namespace content 193 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698