Skip to content

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 20, 2014
1 parent dc70630 commit b8f58a1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions media/vaapi_video_decode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,21 @@ 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);

// See bug https://crosswalk-project.org/jira/browse/XWALK-2265.
// The following small piece of code is a workaround for the current VDA
// texture output implementation. It can be removed when zero buffer copy
// is implemented.
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 b8f58a1

Please sign in to comment.