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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2562003003: Fix the size of video textures uploaded to WebGL. (Closed)
Patch Set: Rebased. Fixed Android build. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/webmediaplayer_ms.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index ede5afb49a4ae2f18427633ec26757b4c38ffcc2..d3a458c967751d764d08c1fd5c7134bf4bed3d10 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -576,8 +576,6 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas,
bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture(
gpu::gles2::GLES2Interface* gl,
unsigned int texture,
- unsigned int internal_format,
- unsigned int type,
bool premultiply_alpha,
bool flip_y) {
DCHECK(main_thread_checker_.CalledOnValidThread());
@@ -606,9 +604,16 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture(
// value down to get the expected result.
// flip_y==true means to reverse the video orientation while
// flip_y==false means to keep the intrinsic orientation.
- gl->CopyTextureCHROMIUM(src_texture, 0, texture, 0, internal_format, type,
- flip_y, premultiply_alpha, false);
+ // The video's texture might be larger than the natural size because
+ // the encoder might have had to round up to the size of a macroblock.
+ // Make sure to only copy the natural size to avoid putting garbage
+ // into the bottom of the destination texture.
+ const gfx::Size& natural_size = video_frame->natural_size();
+ gl->CopySubTextureCHROMIUM(src_texture, 0, texture, 0,
+ 0, 0, 0, 0,
+ natural_size.width(), natural_size.height(),
+ flip_y, premultiply_alpha, false);
gl->DeleteTextures(1, &src_texture);
gl->Flush();
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/webmediaplayer_ms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698