| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 21 matching lines...) Expand all Loading... |
| 32 namespace webrtc { | 32 namespace webrtc { |
| 33 | 33 |
| 34 class RtcpIntraFrameObserver; | 34 class RtcpIntraFrameObserver; |
| 35 class TransportFeedbackObserver; | 35 class TransportFeedbackObserver; |
| 36 | 36 |
| 37 std::string | 37 std::string |
| 38 VideoSendStream::Config::EncoderSettings::ToString() const { | 38 VideoSendStream::Config::EncoderSettings::ToString() const { |
| 39 std::stringstream ss; | 39 std::stringstream ss; |
| 40 ss << "{payload_name: " << payload_name; | 40 ss << "{payload_name: " << payload_name; |
| 41 ss << ", payload_type: " << payload_type; | 41 ss << ", payload_type: " << payload_type; |
| 42 ss << ", encoder: " << (encoder != nullptr ? "(VideoEncoder)" : "nullptr"); | 42 ss << ", encoder: " << (encoder ? "(VideoEncoder)" : "nullptr"); |
| 43 ss << '}'; | 43 ss << '}'; |
| 44 return ss.str(); | 44 return ss.str(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 std::string VideoSendStream::Config::Rtp::Rtx::ToString() | 47 std::string VideoSendStream::Config::Rtp::Rtx::ToString() |
| 48 const { | 48 const { |
| 49 std::stringstream ss; | 49 std::stringstream ss; |
| 50 ss << "{ssrcs: ["; | 50 ss << "{ssrcs: ["; |
| 51 for (size_t i = 0; i < ssrcs.size(); ++i) { | 51 for (size_t i = 0; i < ssrcs.size(); ++i) { |
| 52 ss << ssrcs[i]; | 52 ss << ssrcs[i]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ss << ", c_name: " << c_name; | 87 ss << ", c_name: " << c_name; |
| 88 ss << '}'; | 88 ss << '}'; |
| 89 return ss.str(); | 89 return ss.str(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 std::string VideoSendStream::Config::ToString() const { | 92 std::string VideoSendStream::Config::ToString() const { |
| 93 std::stringstream ss; | 93 std::stringstream ss; |
| 94 ss << "{encoder_settings: " << encoder_settings.ToString(); | 94 ss << "{encoder_settings: " << encoder_settings.ToString(); |
| 95 ss << ", rtp: " << rtp.ToString(); | 95 ss << ", rtp: " << rtp.ToString(); |
| 96 ss << ", pre_encode_callback: " | 96 ss << ", pre_encode_callback: " |
| 97 << (pre_encode_callback != nullptr ? "(I420FrameCallback)" : "nullptr"); | 97 << (pre_encode_callback ? "(I420FrameCallback)" : "nullptr"); |
| 98 ss << ", post_encode_callback: " << (post_encode_callback != nullptr | 98 ss << ", post_encode_callback: " |
| 99 ? "(EncodedFrameObserver)" | 99 << (post_encode_callback ? "(EncodedFrameObserver)" : "nullptr"); |
| 100 : "nullptr"); | 100 ss << ", local_renderer: " |
| 101 ss << ", local_renderer: " << (local_renderer != nullptr ? "(VideoRenderer)" | 101 << (local_renderer ? "(VideoRenderer)" : "nullptr"); |
| 102 : "nullptr"); | |
| 103 ss << ", render_delay_ms: " << render_delay_ms; | 102 ss << ", render_delay_ms: " << render_delay_ms; |
| 104 ss << ", target_delay_ms: " << target_delay_ms; | 103 ss << ", target_delay_ms: " << target_delay_ms; |
| 105 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on" | 104 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on" |
| 106 : "off"); | 105 : "off"); |
| 107 ss << '}'; | 106 ss << '}'; |
| 108 return ss.str(); | 107 return ss.str(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 namespace { | 110 namespace { |
| 112 | 111 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 kRtpPacketSizeOverhead); | 278 kRtpPacketSizeOverhead); |
| 280 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 279 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 281 rtp_rtcp->RegisterRtcpStatisticsCallback(&stats_proxy_); | 280 rtp_rtcp->RegisterRtcpStatisticsCallback(&stats_proxy_); |
| 282 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); | 281 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); |
| 283 rtp_rtcp->SetMaxTransferUnit(mtu); | 282 rtp_rtcp->SetMaxTransferUnit(mtu); |
| 284 rtp_rtcp->RegisterVideoSendPayload( | 283 rtp_rtcp->RegisterVideoSendPayload( |
| 285 config_.encoder_settings.payload_type, | 284 config_.encoder_settings.payload_type, |
| 286 config_.encoder_settings.payload_name.c_str()); | 285 config_.encoder_settings.payload_name.c_str()); |
| 287 } | 286 } |
| 288 | 287 |
| 289 RTC_DCHECK(config.encoder_settings.encoder != nullptr); | 288 RTC_DCHECK(config.encoder_settings.encoder); |
| 290 RTC_DCHECK_GE(config.encoder_settings.payload_type, 0); | 289 RTC_DCHECK_GE(config.encoder_settings.payload_type, 0); |
| 291 RTC_DCHECK_LE(config.encoder_settings.payload_type, 127); | 290 RTC_DCHECK_LE(config.encoder_settings.payload_type, 127); |
| 292 RTC_CHECK_EQ(0, vie_encoder_.RegisterExternalEncoder( | 291 RTC_CHECK_EQ(0, vie_encoder_.RegisterExternalEncoder( |
| 293 config.encoder_settings.encoder, | 292 config.encoder_settings.encoder, |
| 294 config.encoder_settings.payload_type, | 293 config.encoder_settings.payload_type, |
| 295 config.encoder_settings.internal_source)); | 294 config.encoder_settings.internal_source)); |
| 296 | 295 |
| 297 ReconfigureVideoEncoder(encoder_config); | 296 ReconfigureVideoEncoder(encoder_config); |
| 298 | 297 |
| 299 vie_channel_.RegisterSendSideDelayObserver(&stats_proxy_); | 298 vie_channel_.RegisterSendSideDelayObserver(&stats_proxy_); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 420 |
| 422 if (video_codec.codecType == kVideoCodecVP8) { | 421 if (video_codec.codecType == kVideoCodecVP8) { |
| 423 video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings(); | 422 video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings(); |
| 424 } else if (video_codec.codecType == kVideoCodecVP9) { | 423 } else if (video_codec.codecType == kVideoCodecVP9) { |
| 425 video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings(); | 424 video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings(); |
| 426 } else if (video_codec.codecType == kVideoCodecH264) { | 425 } else if (video_codec.codecType == kVideoCodecH264) { |
| 427 video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); | 426 video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); |
| 428 } | 427 } |
| 429 | 428 |
| 430 if (video_codec.codecType == kVideoCodecVP8) { | 429 if (video_codec.codecType == kVideoCodecVP8) { |
| 431 if (config.encoder_specific_settings != nullptr) { | 430 if (config.encoder_specific_settings) { |
| 432 video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>( | 431 video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>( |
| 433 config.encoder_specific_settings); | 432 config.encoder_specific_settings); |
| 434 } | 433 } |
| 435 video_codec.codecSpecific.VP8.numberOfTemporalLayers = | 434 video_codec.codecSpecific.VP8.numberOfTemporalLayers = |
| 436 static_cast<unsigned char>( | 435 static_cast<unsigned char>( |
| 437 streams.back().temporal_layer_thresholds_bps.size() + 1); | 436 streams.back().temporal_layer_thresholds_bps.size() + 1); |
| 438 } else if (video_codec.codecType == kVideoCodecVP9) { | 437 } else if (video_codec.codecType == kVideoCodecVP9) { |
| 439 if (config.encoder_specific_settings != nullptr) { | 438 if (config.encoder_specific_settings) { |
| 440 video_codec.codecSpecific.VP9 = *reinterpret_cast<const VideoCodecVP9*>( | 439 video_codec.codecSpecific.VP9 = *reinterpret_cast<const VideoCodecVP9*>( |
| 441 config.encoder_specific_settings); | 440 config.encoder_specific_settings); |
| 442 if (video_codec.mode == kScreensharing) { | 441 if (video_codec.mode == kScreensharing) { |
| 443 video_codec.codecSpecific.VP9.flexibleMode = true; | 442 video_codec.codecSpecific.VP9.flexibleMode = true; |
| 444 // For now VP9 screensharing use 1 temporal and 2 spatial layers. | 443 // For now VP9 screensharing use 1 temporal and 2 spatial layers. |
| 445 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfTemporalLayers, 1); | 444 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfTemporalLayers, 1); |
| 446 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfSpatialLayers, 2); | 445 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfSpatialLayers, 2); |
| 447 } | 446 } |
| 448 } | 447 } |
| 449 video_codec.codecSpecific.VP9.numberOfTemporalLayers = | 448 video_codec.codecSpecific.VP9.numberOfTemporalLayers = |
| 450 static_cast<unsigned char>( | 449 static_cast<unsigned char>( |
| 451 streams.back().temporal_layer_thresholds_bps.size() + 1); | 450 streams.back().temporal_layer_thresholds_bps.size() + 1); |
| 452 } else if (video_codec.codecType == kVideoCodecH264) { | 451 } else if (video_codec.codecType == kVideoCodecH264) { |
| 453 if (config.encoder_specific_settings != nullptr) { | 452 if (config.encoder_specific_settings) { |
| 454 video_codec.codecSpecific.H264 = *reinterpret_cast<const VideoCodecH264*>( | 453 video_codec.codecSpecific.H264 = *reinterpret_cast<const VideoCodecH264*>( |
| 455 config.encoder_specific_settings); | 454 config.encoder_specific_settings); |
| 456 } | 455 } |
| 457 } else { | 456 } else { |
| 458 // TODO(pbos): Support encoder_settings codec-agnostically. | 457 // TODO(pbos): Support encoder_settings codec-agnostically. |
| 459 RTC_DCHECK(config.encoder_specific_settings == nullptr) | 458 RTC_DCHECK(!config.encoder_specific_settings) |
| 460 << "Encoder-specific settings for codec type not wired up."; | 459 << "Encoder-specific settings for codec type not wired up."; |
| 461 } | 460 } |
| 462 | 461 |
| 463 strncpy(video_codec.plName, | 462 strncpy(video_codec.plName, |
| 464 config_.encoder_settings.payload_name.c_str(), | 463 config_.encoder_settings.payload_name.c_str(), |
| 465 kPayloadNameSize - 1); | 464 kPayloadNameSize - 1); |
| 466 video_codec.plName[kPayloadNameSize - 1] = '\0'; | 465 video_codec.plName[kPayloadNameSize - 1] = '\0'; |
| 467 video_codec.plType = config_.encoder_settings.payload_type; | 466 video_codec.plType = config_.encoder_settings.payload_type; |
| 468 video_codec.numberOfSimulcastStreams = | 467 video_codec.numberOfSimulcastStreams = |
| 469 static_cast<unsigned char>(streams.size()); | 468 static_cast<unsigned char>(streams.size()); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 } | 629 } |
| 631 | 630 |
| 632 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, | 631 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, |
| 633 uint8_t fraction_loss, | 632 uint8_t fraction_loss, |
| 634 int64_t rtt) { | 633 int64_t rtt) { |
| 635 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); | 634 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); |
| 636 } | 635 } |
| 637 | 636 |
| 638 } // namespace internal | 637 } // namespace internal |
| 639 } // namespace webrtc | 638 } // namespace webrtc |
| OLD | NEW |