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

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

Issue 2150833002: [Chromoting] Fallback to use software renderer if desktop image size is larger than GPU limitaiton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 b60f9bd72bb9e99d3745093ef73a7b674226b289..675fff673afe5b509ec3ea055dcd1bf9f4828fe5 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_3d.cc
@@ -10,7 +10,6 @@
#include <utility>
#include "ppapi/c/pp_codecs.h"
-#include "ppapi/c/ppb_opengles2.h"
#include "ppapi/c/ppb_video_decoder.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/lib/gl/include/GLES2/gl2.h"
@@ -91,11 +90,15 @@ void PepperVideoRenderer3D::SetPepperContext(
DCHECK(event_handler);
DCHECK(!event_handler_);
+ fallback_renderer_.SetPepperContext(instance, event_handler);
+
event_handler_ = event_handler;
pp_instance_ = instance;
}
void PepperVideoRenderer3D::OnViewChanged(const pp::View& view) {
+ fallback_renderer_.OnViewChanged(view);
+
pp::Size size = view.GetRect().size();
float scale = view.GetDeviceScale();
view_size_.set(ceilf(size.width() * scale), ceilf(size.height() * scale));
@@ -106,12 +109,16 @@ void PepperVideoRenderer3D::OnViewChanged(const pp::View& view) {
}
void PepperVideoRenderer3D::EnableDebugDirtyRegion(bool enable) {
+ fallback_renderer_.EnableDebugDirtyRegion(enable);
debug_dirty_region_ = enable;
}
bool PepperVideoRenderer3D::Initialize(
const ClientContext& context,
protocol::FrameStatsConsumer* stats_consumer) {
+ fallback_renderer_usable_ =
+ fallback_renderer_.Initialize(context, stats_consumer);
+
stats_consumer_ = stats_consumer;
const int32_t context_attributes[] = {
@@ -166,6 +173,8 @@ bool PepperVideoRenderer3D::Initialize(
gles2_if_->BindBuffer(graphics_3d, GL_ARRAY_BUFFER, buffer);
gles2_if_->BufferData(graphics_3d, GL_ARRAY_BUFFER, sizeof(kVertices),
kVertices, GL_STATIC_DRAW);
+ gles2_if_->GetIntegerv(
+ graphics_3d, GL_MAX_TEXTURE_SIZE, &gl_max_texture_size_);
CheckGLError();
@@ -174,6 +183,8 @@ bool PepperVideoRenderer3D::Initialize(
void PepperVideoRenderer3D::OnSessionConfig(
const protocol::SessionConfig& config) {
+ fallback_renderer_.OnSessionConfig(config);
+
PP_VideoProfile video_profile = PP_VIDEOPROFILE_VP8_ANY;
switch (config.video_config().codec) {
case protocol::ChannelConfig::CODEC_VP8:
@@ -212,6 +223,18 @@ protocol::FrameStatsConsumer* PepperVideoRenderer3D::GetFrameStatsConsumer() {
void PepperVideoRenderer3D::ProcessVideoPacket(
std::unique_ptr<VideoPacket> packet,
const base::Closure& done) {
+ if (!use_fallback_renderer_ && fallback_renderer_usable_) {
+ use_fallback_renderer_ =
Sergey Ulanov 2016/07/14 17:45:28 Once we start using the fallback renderer I think
Hzj_jie 2016/07/15 02:30:50 No, if use_fallback_renderer_ is true, it won't fa
+ gl_max_texture_size_ < packet->format().screen_width() ||
Sergey Ulanov 2016/07/14 17:45:28 nit: would be more readable if this condition was
Sergey Ulanov 2016/07/14 17:45:28 screen_width() and screen_height() are set only wh
Hzj_jie 2016/07/15 02:30:50 I believe in protobuf, an unset integer field is a
Hzj_jie 2016/07/15 02:30:50 Done.
Sergey Ulanov 2016/07/15 23:33:18 It's true, but in general it's usually better to c
Hzj_jie 2016/07/16 01:19:21 Done.
+ gl_max_texture_size_ < packet->format().screen_height();
+ }
+
+ if (use_fallback_renderer_) {
+ fallback_renderer_.GetVideoStub()->ProcessVideoPacket(
+ std::move(packet), done);
+ return;
+ }
+
VideoPacket* packet_ptr = packet.get();
std::unique_ptr<FrameTracker> frame_tracker(
new FrameTracker(std::move(packet), stats_consumer_, done));

Powered by Google App Engine
This is Rietveld 408576698