OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/webrtc_video_encoder_vpx.h" | 5 #include "remoting/codec/webrtc_video_encoder_vpx.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 act_map.cols = active_map_size_.width(); | 293 act_map.cols = active_map_size_.width(); |
294 act_map.active_map = active_map_.get(); | 294 act_map.active_map = active_map_.get(); |
295 | 295 |
296 webrtc::DesktopRegion updated_region; | 296 webrtc::DesktopRegion updated_region; |
297 // Convert the updated capture data ready for encode. | 297 // Convert the updated capture data ready for encode. |
298 PrepareImage(frame, &updated_region); | 298 PrepareImage(frame, &updated_region); |
299 | 299 |
300 // Update active map based on updated region. | 300 // Update active map based on updated region. |
301 if (params.clear_active_map) | 301 if (params.clear_active_map) |
302 ClearActiveMap(); | 302 ClearActiveMap(); |
| 303 |
| 304 if (params.key_frame) |
| 305 updated_region.SetRect(webrtc::DesktopRect::MakeSize(frame.size())); |
| 306 |
303 SetActiveMapFromRegion(updated_region); | 307 SetActiveMapFromRegion(updated_region); |
304 | 308 |
305 // Apply active map to the encoder. | 309 // Apply active map to the encoder. |
306 if (vpx_codec_control(codec_.get(), VP8E_SET_ACTIVEMAP, &act_map)) { | 310 if (vpx_codec_control(codec_.get(), VP8E_SET_ACTIVEMAP, &act_map)) { |
307 LOG(ERROR) << "Unable to apply active map"; | 311 LOG(ERROR) << "Unable to apply active map"; |
308 } | 312 } |
309 | 313 |
310 vpx_codec_err_t ret = vpx_codec_encode( | 314 vpx_codec_err_t ret = vpx_codec_encode( |
311 codec_.get(), image_.get(), 0, params.duration.InMicroseconds(), | 315 codec_.get(), image_.get(), 0, params.duration.InMicroseconds(), |
312 (params.key_frame) ? VPX_EFLAG_FORCE_KF : 0, VPX_DL_REALTIME); | 316 (params.key_frame) ? VPX_EFLAG_FORCE_KF : 0, VPX_DL_REALTIME); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 kMacroBlockSize * (y + 1))); | 598 kMacroBlockSize * (y + 1))); |
595 } | 599 } |
596 x0 = x1 + 1; | 600 x0 = x1 + 1; |
597 } | 601 } |
598 } | 602 } |
599 updated_region->IntersectWith( | 603 updated_region->IntersectWith( |
600 webrtc::DesktopRect::MakeWH(image_->w, image_->h)); | 604 webrtc::DesktopRect::MakeWH(image_->w, image_->h)); |
601 } | 605 } |
602 | 606 |
603 } // namespace remoting | 607 } // namespace remoting |
OLD | NEW |