Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
Fixed screen displayed abnormally when playing some size of html5 mp4…
Browse files Browse the repository at this point in the history
… videos

This patch is cherry picked from Qing's PR
crosswalk-project/chromium-crosswalk#166

Bug = XWALK-2265
  • Loading branch information
qjia7 committed Aug 19, 2014
1 parent dc70630 commit 77ea8e8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions media/vaapi_video_decode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ bool VaapiVideoDecodeAccelerator::TFPPicture::Upload(VASurfaceID surface) {
gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

unsigned int al = 4 * size_.width();
if (al != va_image_.pitches[0]) {
// Not aligned phenomenon occurs only in special size video in None-X11.
// So re-check RGBA data alignment and realign filled video frame in need.
unsigned char* bhandle = static_cast<unsigned char*>(buffer);
for (int i = 0; i < size_.height(); i++) {
memcpy(bhandle + (i * al), bhandle + (i * (va_image_.pitches[0])), al);
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.width(), size_.height(),
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

Expand Down

0 comments on commit 77ea8e8

Please sign in to comment.