| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/codec/video_decoder_vpx.h" | 5 #include "remoting/codec/video_decoder_vpx.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 region->Clear(); | 110 region->Clear(); |
| 111 for (int i = 0; i < packet.dirty_rects_size(); ++i) { | 111 for (int i = 0; i < packet.dirty_rects_size(); ++i) { |
| 112 Rect proto_rect = packet.dirty_rects(i); | 112 Rect proto_rect = packet.dirty_rects(i); |
| 113 webrtc::DesktopRect rect = | 113 webrtc::DesktopRect rect = |
| 114 webrtc::DesktopRect::MakeXYWH(proto_rect.x(), proto_rect.y(), | 114 webrtc::DesktopRect::MakeXYWH(proto_rect.x(), proto_rect.y(), |
| 115 proto_rect.width(), proto_rect.height()); | 115 proto_rect.width(), proto_rect.height()); |
| 116 region->AddRect(rect); | 116 region->AddRect(rect); |
| 117 RenderRect(image, rect, frame); | 117 RenderRect(image, rect, frame); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Process the frame shape, if supplied. | |
| 121 if (packet.has_use_desktop_shape()) { | |
| 122 if (packet.use_desktop_shape()) { | |
| 123 if (!desktop_shape_) | |
| 124 desktop_shape_ = make_scoped_ptr(new webrtc::DesktopRegion); | |
| 125 desktop_shape_->Clear(); | |
| 126 for (int i = 0; i < packet.desktop_shape_rects_size(); ++i) { | |
| 127 Rect proto_rect = packet.desktop_shape_rects(i); | |
| 128 desktop_shape_->AddRect(webrtc::DesktopRect::MakeXYWH( | |
| 129 proto_rect.x(), proto_rect.y(), proto_rect.width(), | |
| 130 proto_rect.height())); | |
| 131 } | |
| 132 } else { | |
| 133 desktop_shape_.reset(); | |
| 134 } | |
| 135 } | |
| 136 | |
| 137 if (desktop_shape_) | |
| 138 frame->set_shape(new webrtc::DesktopRegion(*desktop_shape_)); | |
| 139 | |
| 140 return true; | 120 return true; |
| 141 } | 121 } |
| 142 | 122 |
| 143 VideoDecoderVpx::VideoDecoderVpx(vpx_codec_iface_t* codec) { | 123 VideoDecoderVpx::VideoDecoderVpx(vpx_codec_iface_t* codec) { |
| 144 codec_.reset(new vpx_codec_ctx_t); | 124 codec_.reset(new vpx_codec_ctx_t); |
| 145 | 125 |
| 146 vpx_codec_dec_cfg config; | 126 vpx_codec_dec_cfg config; |
| 147 config.w = 0; | 127 config.w = 0; |
| 148 config.h = 0; | 128 config.h = 0; |
| 149 config.threads = 2; | 129 config.threads = 2; |
| 150 vpx_codec_err_t ret = vpx_codec_dec_init(codec_.get(), codec, &config, 0); | 130 vpx_codec_err_t ret = vpx_codec_dec_init(codec_.get(), codec, &config, 0); |
| 151 CHECK_EQ(VPX_CODEC_OK, ret); | 131 CHECK_EQ(VPX_CODEC_OK, ret); |
| 152 } | 132 } |
| 153 | 133 |
| 154 } // namespace remoting | 134 } // namespace remoting |
| OLD | NEW |