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_encoder_vpx.h" | 5 #include "remoting/codec/video_encoder_vpx.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "remoting/base/util.h" | 10 #include "remoting/base/util.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 if (use_vp9_ && !lossless_encode_) { | 319 if (use_vp9_ && !lossless_encode_) { |
320 ret = vpx_codec_control(codec_.get(), VP9E_GET_ACTIVEMAP, &act_map); | 320 ret = vpx_codec_control(codec_.get(), VP9E_GET_ACTIVEMAP, &act_map); |
321 DCHECK_EQ(ret, VPX_CODEC_OK) | 321 DCHECK_EQ(ret, VPX_CODEC_OK) |
322 << "Failed to fetch active map: " | 322 << "Failed to fetch active map: " |
323 << vpx_codec_err_to_string(ret) << "\n"; | 323 << vpx_codec_err_to_string(ret) << "\n"; |
324 UpdateRegionFromActiveMap(&updated_region); | 324 UpdateRegionFromActiveMap(&updated_region); |
325 } | 325 } |
326 | 326 |
327 // Read the encoded data. | 327 // Read the encoded data. |
328 vpx_codec_iter_t iter = NULL; | 328 vpx_codec_iter_t iter = nullptr; |
329 bool got_data = false; | 329 bool got_data = false; |
330 | 330 |
331 // TODO(hclam): Make sure we get exactly one frame from the packet. | 331 // TODO(hclam): Make sure we get exactly one frame from the packet. |
332 // TODO(hclam): We should provide the output buffer to avoid one copy. | 332 // TODO(hclam): We should provide the output buffer to avoid one copy. |
333 scoped_ptr<VideoPacket> packet( | 333 scoped_ptr<VideoPacket> packet( |
334 helper_.CreateVideoPacketWithUpdatedRegion(frame, updated_region)); | 334 helper_.CreateVideoPacketWithUpdatedRegion(frame, updated_region)); |
335 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); | 335 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); |
336 | 336 |
337 while (!got_data) { | 337 while (!got_data) { |
338 const vpx_codec_cx_pkt_t* vpx_packet = | 338 const vpx_codec_cx_pkt_t* vpx_packet = |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 kMacroBlockSize * (y + 1))); | 545 kMacroBlockSize * (y + 1))); |
546 } | 546 } |
547 x0 = x1 + 1; | 547 x0 = x1 + 1; |
548 } | 548 } |
549 } | 549 } |
550 updated_region->IntersectWith( | 550 updated_region->IntersectWith( |
551 webrtc::DesktopRect::MakeWH(image_->w, image_->h)); | 551 webrtc::DesktopRect::MakeWH(image_->w, image_->h)); |
552 } | 552 } |
553 | 553 |
554 } // namespace remoting | 554 } // namespace remoting |
OLD | NEW |