| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } else { | 413 } else { |
| 414 SetVp8CodecParameters(&config_, size); | 414 SetVp8CodecParameters(&config_, size); |
| 415 } | 415 } |
| 416 | 416 |
| 417 config_.rc_target_bitrate = kDefaultTargetBitrateKbps; | 417 config_.rc_target_bitrate = kDefaultTargetBitrateKbps; |
| 418 | 418 |
| 419 // Initialize or re-configure the codec with the custom configuration. | 419 // Initialize or re-configure the codec with the custom configuration. |
| 420 if (!codec_) { | 420 if (!codec_) { |
| 421 codec_.reset(new vpx_codec_ctx_t); | 421 codec_.reset(new vpx_codec_ctx_t); |
| 422 ret = vpx_codec_enc_init(codec_.get(), interface, &config_, 0); | 422 ret = vpx_codec_enc_init(codec_.get(), interface, &config_, 0); |
| 423 CHECK_EQ(VPX_CODEC_OK, ret) << "Failed to initialize codec"; | 423 // Failed to initialize codec |
| 424 CHECK_EQ(VPX_CODEC_OK, ret); |
| 424 } else { | 425 } else { |
| 425 ret = vpx_codec_enc_config_set(codec_.get(), &config_); | 426 ret = vpx_codec_enc_config_set(codec_.get(), &config_); |
| 426 CHECK_EQ(VPX_CODEC_OK, ret) << "Failed to reconfigure codec"; | 427 // Failed to reconfigure codec |
| 428 CHECK_EQ(VPX_CODEC_OK, ret); |
| 427 } | 429 } |
| 428 | 430 |
| 429 // Apply further customizations to the codec now it's initialized. | 431 // Apply further customizations to the codec now it's initialized. |
| 430 if (use_vp9_) { | 432 if (use_vp9_) { |
| 431 SetVp9CodecOptions(codec_.get(), lossless_encode_); | 433 SetVp9CodecOptions(codec_.get(), lossless_encode_); |
| 432 } else { | 434 } else { |
| 433 SetVp8CodecOptions(codec_.get()); | 435 SetVp8CodecOptions(codec_.get()); |
| 434 } | 436 } |
| 435 } | 437 } |
| 436 | 438 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 kMacroBlockSize * (y + 1))); | 600 kMacroBlockSize * (y + 1))); |
| 599 } | 601 } |
| 600 x0 = x1 + 1; | 602 x0 = x1 + 1; |
| 601 } | 603 } |
| 602 } | 604 } |
| 603 updated_region->IntersectWith( | 605 updated_region->IntersectWith( |
| 604 webrtc::DesktopRect::MakeWH(image_->w, image_->h)); | 606 webrtc::DesktopRect::MakeWH(image_->w, image_->h)); |
| 605 } | 607 } |
| 606 | 608 |
| 607 } // namespace remoting | 609 } // namespace remoting |
| OLD | NEW |