| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 VideoCodecType codec_type = webrtc::kVideoCodecI420; | 156 VideoCodecType codec_type = webrtc::kVideoCodecI420; |
| 157 #endif | 157 #endif |
| 158 VideoCodec video_codec; | 158 VideoCodec video_codec; |
| 159 if (vcm_->Codec(codec_type, &video_codec) != VCM_OK) { | 159 if (vcm_->Codec(codec_type, &video_codec) != VCM_OK) { |
| 160 return false; | 160 return false; |
| 161 } | 161 } |
| 162 { | 162 { |
| 163 CriticalSectionScoped cs(data_cs_.get()); | 163 CriticalSectionScoped cs(data_cs_.get()); |
| 164 send_padding_ = video_codec.numberOfSimulcastStreams > 1; | 164 send_padding_ = video_codec.numberOfSimulcastStreams > 1; |
| 165 } | 165 } |
| 166 if (vcm_->RegisterSendCodec(&video_codec, number_of_cores_, | 166 if (vcm_->RegisterSendCodec( |
| 167 PayloadRouter::DefaultMaxPayloadLength()) != | 167 &video_codec, number_of_cores_, |
| 168 static_cast<uint32_t>(PayloadRouter::DefaultMaxPayloadLength())) != |
| 168 0) { | 169 0) { |
| 169 return false; | 170 return false; |
| 170 } | 171 } |
| 171 } | 172 } |
| 172 if (vcm_->RegisterTransportCallback(this) != 0) { | 173 if (vcm_->RegisterTransportCallback(this) != 0) { |
| 173 return false; | 174 return false; |
| 174 } | 175 } |
| 175 if (vcm_->RegisterSendStatisticsCallback(this) != 0) { | 176 if (vcm_->RegisterSendStatisticsCallback(this) != 0) { |
| 176 return false; | 177 return false; |
| 177 } | 178 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 { | 292 { |
| 292 CriticalSectionScoped cs(data_cs_.get()); | 293 CriticalSectionScoped cs(data_cs_.get()); |
| 293 send_padding_ = current_send_codec.numberOfSimulcastStreams > 1; | 294 send_padding_ = current_send_codec.numberOfSimulcastStreams > 1; |
| 294 } | 295 } |
| 295 // TODO(mflodman): Unfortunately the VideoCodec that VCM has cached a | 296 // TODO(mflodman): Unfortunately the VideoCodec that VCM has cached a |
| 296 // raw pointer to an |extra_options| that's long gone. Clearing it here is | 297 // raw pointer to an |extra_options| that's long gone. Clearing it here is |
| 297 // a hack to prevent the following code from crashing. This should be fixed | 298 // a hack to prevent the following code from crashing. This should be fixed |
| 298 // for realz. https://code.google.com/p/chromium/issues/detail?id=348222 | 299 // for realz. https://code.google.com/p/chromium/issues/detail?id=348222 |
| 299 current_send_codec.extra_options = NULL; | 300 current_send_codec.extra_options = NULL; |
| 300 size_t max_data_payload_length = send_payload_router_->MaxPayloadLength(); | 301 size_t max_data_payload_length = send_payload_router_->MaxPayloadLength(); |
| 301 if (vcm_->RegisterSendCodec(¤t_send_codec, number_of_cores_, | 302 if (vcm_->RegisterSendCodec( |
| 302 max_data_payload_length) != VCM_OK) { | 303 ¤t_send_codec, number_of_cores_, |
| 304 static_cast<uint32_t>(max_data_payload_length)) != VCM_OK) { |
| 303 LOG(LS_INFO) << "De-registered the currently used external encoder (" | 305 LOG(LS_INFO) << "De-registered the currently used external encoder (" |
| 304 << static_cast<int>(pl_type) << ") and therefore tried to " | 306 << static_cast<int>(pl_type) << ") and therefore tried to " |
| 305 << "register the corresponding internal encoder, but none " | 307 << "register the corresponding internal encoder, but none " |
| 306 << "was supported."; | 308 << "was supported."; |
| 307 } | 309 } |
| 308 } | 310 } |
| 309 return 0; | 311 return 0; |
| 310 } | 312 } |
| 311 | 313 |
| 312 int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { | 314 int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 bitrate_allocator_->GetMinMaxBitrateSumBps(&new_bwe_min_bps, | 349 bitrate_allocator_->GetMinMaxBitrateSumBps(&new_bwe_min_bps, |
| 348 &new_bwe_max_bps); | 350 &new_bwe_max_bps); |
| 349 bitrate_controller_->SetMinMaxBitrate(new_bwe_min_bps, new_bwe_max_bps); | 351 bitrate_controller_->SetMinMaxBitrate(new_bwe_min_bps, new_bwe_max_bps); |
| 350 } | 352 } |
| 351 | 353 |
| 352 webrtc::VideoCodec modified_video_codec = video_codec; | 354 webrtc::VideoCodec modified_video_codec = video_codec; |
| 353 modified_video_codec.startBitrate = allocated_bitrate_bps / 1000; | 355 modified_video_codec.startBitrate = allocated_bitrate_bps / 1000; |
| 354 | 356 |
| 355 size_t max_data_payload_length = send_payload_router_->MaxPayloadLength(); | 357 size_t max_data_payload_length = send_payload_router_->MaxPayloadLength(); |
| 356 if (vcm_->RegisterSendCodec(&modified_video_codec, number_of_cores_, | 358 if (vcm_->RegisterSendCodec(&modified_video_codec, number_of_cores_, |
| 357 max_data_payload_length) != VCM_OK) { | 359 static_cast<uint32_t>(max_data_payload_length)) != |
| 360 VCM_OK) { |
| 358 return -1; | 361 return -1; |
| 359 } | 362 } |
| 360 return 0; | 363 return 0; |
| 361 } | 364 } |
| 362 | 365 |
| 363 int32_t ViEEncoder::GetEncoder(VideoCodec* video_codec) { | 366 int32_t ViEEncoder::GetEncoder(VideoCodec* video_codec) { |
| 364 *video_codec = vcm_->GetSendCodec(); | 367 *video_codec = vcm_->GetSendCodec(); |
| 365 return 0; | 368 return 0; |
| 366 } | 369 } |
| 367 | 370 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 if (vcm_->SendCodec(&codec) == 0) { | 623 if (vcm_->SendCodec(&codec) == 0) { |
| 621 uint32_t current_bitrate_bps = 0; | 624 uint32_t current_bitrate_bps = 0; |
| 622 if (vcm_->Bitrate(¤t_bitrate_bps) != 0) { | 625 if (vcm_->Bitrate(¤t_bitrate_bps) != 0) { |
| 623 LOG_F(LS_WARNING) << | 626 LOG_F(LS_WARNING) << |
| 624 "Failed to get the current encoder target bitrate."; | 627 "Failed to get the current encoder target bitrate."; |
| 625 } | 628 } |
| 626 // Convert to start bitrate in kbps. | 629 // Convert to start bitrate in kbps. |
| 627 codec.startBitrate = (current_bitrate_bps + 500) / 1000; | 630 codec.startBitrate = (current_bitrate_bps + 500) / 1000; |
| 628 size_t max_payload_length = send_payload_router_->MaxPayloadLength(); | 631 size_t max_payload_length = send_payload_router_->MaxPayloadLength(); |
| 629 if (vcm_->RegisterSendCodec(&codec, number_of_cores_, | 632 if (vcm_->RegisterSendCodec(&codec, number_of_cores_, |
| 630 max_payload_length) != 0) { | 633 static_cast<uint32_t>(max_payload_length)) != |
| 634 0) { |
| 631 return -1; | 635 return -1; |
| 632 } | 636 } |
| 633 } | 637 } |
| 634 } | 638 } |
| 635 return 0; | 639 return 0; |
| 636 } | 640 } |
| 637 | 641 |
| 638 void ViEEncoder::SetSenderBufferingMode(int target_delay_ms) { | 642 void ViEEncoder::SetSenderBufferingMode(int target_delay_ms) { |
| 639 { | 643 { |
| 640 CriticalSectionScoped cs(data_cs_.get()); | 644 CriticalSectionScoped cs(data_cs_.get()); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 } | 862 } |
| 859 | 863 |
| 860 int32_t QMVideoSettingsCallback::SetVideoQMSettings( | 864 int32_t QMVideoSettingsCallback::SetVideoQMSettings( |
| 861 const uint32_t frame_rate, | 865 const uint32_t frame_rate, |
| 862 const uint32_t width, | 866 const uint32_t width, |
| 863 const uint32_t height) { | 867 const uint32_t height) { |
| 864 return vpm_->SetTargetResolution(width, height, frame_rate); | 868 return vpm_->SetTargetResolution(width, height, frame_rate); |
| 865 } | 869 } |
| 866 | 870 |
| 867 } // namespace webrtc | 871 } // namespace webrtc |
| OLD | NEW |