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

Unified Diff: remoting/client/plugin/pepper_video_renderer_3d.cc

Issue 1411283003: Add workaround for PPB_VideoDecoder not setting visible_rect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/pepper_video_renderer_3d.cc
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.cc b/remoting/client/plugin/pepper_video_renderer_3d.cc
index 9e05d77aaba6dc965a4da6963aba05826960b5be..6277f9b08842cf24782710656028c73bcc27b336 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_3d.cc
@@ -21,13 +21,13 @@
namespace remoting {
// The implementation here requires that the decoder allocates at least 3
-// pictures. PPB_VideoDecode didn't support this parameter prior to
+// pictures. PPB_VideoDecoder didn't support this parameter prior to
// 1.1, so we have to pass 0 for backwards compatibility with older versions of
// the browser. Currently all API implementations allocate more than 3 buffers
// by default.
//
-// TODO(sergeyu): Change this to 3 once PPB_VideoDecode v1.1 is enabled on
-// stable channel.
+// TODO(sergeyu): Change this to 3 once PPB_VideoDecoder v1.1 is enabled on
+// stable channel (crbug.com/520323).
const uint32_t kMinimumPictureCount = 0; // 3
class PepperVideoRenderer3D::PendingPacket {
@@ -313,6 +313,21 @@ void PepperVideoRenderer3D::OnPictureReady(int32_t result,
perf_tracker_->OnFrameDecoded(picture.decode_id);
+ // Workaround crbug.com/542945 by filling in visible_rect if it isn't set.
+ if (picture.visible_rect.size.width == 0 ||
+ picture.visible_rect.size.height == 0) {
+ static bool warning_logged = false;
+ if (!warning_logged) {
+ LOG(WARNING) << "PPB_VideoDecoder doesn't set visible_rect.";
Wez 2015/10/20 04:57:44 What's the point of logging a warning in this case
Sergey Ulanov 2015/10/20 14:37:52 To make it easy to verify if the problem is still
Wez 2015/10/20 17:16:50 You mean easy to see whether the PPAPI has been fi
+ warning_logged = true;
+ }
+
+ picture.visible_rect.size.width =
+ std::min(frame_size_.width(), picture.texture_size.width);
+ picture.visible_rect.size.height =
+ std::min(frame_size_.height(), picture.texture_size.height);
+ }
+
next_picture_.reset(new Picture(&video_decoder_, picture));
PaintIfNeeded();
@@ -340,6 +355,7 @@ void PepperVideoRenderer3D::PaintIfNeeded() {
double scale_x = picture.visible_rect.size.width;
double scale_y = picture.visible_rect.size.height;
if (picture.texture_target != GL_TEXTURE_RECTANGLE_ARB) {
+ CHECK(picture.texture_size.width > 0 && picture.texture_size.height > 0);
scale_x /= picture.texture_size.width;
scale_y /= picture.texture_size.height;
}
@@ -365,6 +381,8 @@ void PepperVideoRenderer3D::PaintIfNeeded() {
// nearest-neighbor scaling to achieve crisper image. Linear filter is used in
// all other cases.
GLint mag_filter = GL_LINEAR;
+ CHECK(picture.visible_rect.size.width > 0 &&
+ picture.visible_rect.size.height > 0);
if (view_size_.width() % picture.visible_rect.size.width == 0 &&
view_size_.height() % picture.visible_rect.size.height == 0) {
mag_filter = GL_NEAREST;
« 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