| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool ViEEncoder::Init() { | 120 bool ViEEncoder::Init() { |
| 121 vp_->EnableTemporalDecimation(true); | 121 vp_->EnableTemporalDecimation(true); |
| 122 | 122 |
| 123 // Enable/disable content analysis: off by default for now. | 123 // Enable/disable content analysis: off by default for now. |
| 124 vp_->EnableContentAnalysis(false); | 124 vp_->EnableContentAnalysis(false); |
| 125 | 125 |
| 126 vcm_->RegisterPostEncodeImageCallback(this); | 126 vcm_->RegisterPostEncodeImageCallback(this); |
| 127 | 127 |
| 128 // TODO(perkj): Remove |RegisterTransportCallback| as soon as we don't use | |
| 129 // VCMPacketizationCallback::OnEncoderImplementationName. | |
| 130 if (vcm_->RegisterTransportCallback(this) != 0) { | |
| 131 return false; | |
| 132 } | |
| 133 if (vcm_->RegisterSendStatisticsCallback(this) != 0) { | 128 if (vcm_->RegisterSendStatisticsCallback(this) != 0) { |
| 134 return false; | 129 return false; |
| 135 } | 130 } |
| 136 return true; | 131 return true; |
| 137 } | 132 } |
| 138 | 133 |
| 139 VideoCodingModule* ViEEncoder::vcm() const { | 134 VideoCodingModule* ViEEncoder::vcm() const { |
| 140 return vcm_.get(); | 135 return vcm_.get(); |
| 141 } | 136 } |
| 142 | 137 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 protection_mode = nack ? kProtectionNack : kProtectionNone; | 397 protection_mode = nack ? kProtectionNack : kProtectionNone; |
| 403 } | 398 } |
| 404 vcm_->SetVideoProtection(protection_mode, true); | 399 vcm_->SetVideoProtection(protection_mode, true); |
| 405 } | 400 } |
| 406 | 401 |
| 407 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { | 402 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { |
| 408 if (stats_proxy_) | 403 if (stats_proxy_) |
| 409 stats_proxy_->OnSetRates(bitrate_bps, framerate); | 404 stats_proxy_->OnSetRates(bitrate_bps, framerate); |
| 410 } | 405 } |
| 411 | 406 |
| 412 void ViEEncoder::OnEncoderImplementationName(const char* implementation_name) { | |
| 413 if (stats_proxy_) | |
| 414 stats_proxy_->OnEncoderImplementationName(implementation_name); | |
| 415 } | |
| 416 | |
| 417 int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image, | 407 int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image, |
| 418 const CodecSpecificInfo* codec_specific_info, | 408 const CodecSpecificInfo* codec_specific_info, |
| 419 const RTPFragmentationHeader* fragmentation) { | 409 const RTPFragmentationHeader* fragmentation) { |
| 420 RTC_DCHECK(send_payload_router_); | 410 RTC_DCHECK(send_payload_router_); |
| 421 | 411 |
| 422 { | 412 { |
| 423 rtc::CritScope lock(&data_cs_); | 413 rtc::CritScope lock(&data_cs_); |
| 424 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); | 414 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); |
| 425 } | 415 } |
| 426 | 416 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 457 if (file_writer) { | 447 if (file_writer) { |
| 458 bool ok = file_writer->WriteFrame(encoded_image); | 448 bool ok = file_writer->WriteFrame(encoded_image); |
| 459 RTC_DCHECK(ok); | 449 RTC_DCHECK(ok); |
| 460 } | 450 } |
| 461 } | 451 } |
| 462 | 452 |
| 463 return success; | 453 return success; |
| 464 } | 454 } |
| 465 | 455 |
| 466 int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate, | 456 int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate, |
| 467 const uint32_t frame_rate) { | 457 const uint32_t frame_rate, |
| 458 std::string&& encoder_name) { |
| 468 if (stats_proxy_) | 459 if (stats_proxy_) |
| 469 stats_proxy_->OnOutgoingRate(frame_rate, bit_rate); | 460 stats_proxy_->OnOutgoingRate(frame_rate, bit_rate, std::move(encoder_name)); |
| 470 return 0; | 461 return 0; |
| 471 } | 462 } |
| 472 | 463 |
| 473 void ViEEncoder::OnReceivedSLI(uint32_t /*ssrc*/, | 464 void ViEEncoder::OnReceivedSLI(uint32_t /*ssrc*/, |
| 474 uint8_t picture_id) { | 465 uint8_t picture_id) { |
| 475 rtc::CritScope lock(&data_cs_); | 466 rtc::CritScope lock(&data_cs_); |
| 476 picture_id_sli_ = picture_id; | 467 picture_id_sli_ = picture_id; |
| 477 has_received_sli_ = true; | 468 has_received_sli_ = true; |
| 478 } | 469 } |
| 479 | 470 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 const uint32_t width, | 543 const uint32_t width, |
| 553 const uint32_t height) { | 544 const uint32_t height) { |
| 554 return vp_->SetTargetResolution(width, height, frame_rate); | 545 return vp_->SetTargetResolution(width, height, frame_rate); |
| 555 } | 546 } |
| 556 | 547 |
| 557 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 548 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
| 558 vp_->SetTargetFramerate(frame_rate); | 549 vp_->SetTargetFramerate(frame_rate); |
| 559 } | 550 } |
| 560 | 551 |
| 561 } // namespace webrtc | 552 } // namespace webrtc |
| OLD | NEW |