编码参数设置到WebRtcEngine模块里 WebRtcVideoChannel,会调用到这里:
`
`
bool WebRtcVideoChannel::GetChangedSendParameters( const VideoSendParameters& params, ChangedSendParameters* changed_params) const { if (!ValidateCodecFormats(params.codecs) || !ValidateRtpExtensions(params.extensions, send_rtp_extensions_)) { return false; } std::vector negotiated_codecs = SelectSendVideoCodecs(MapCodecs(params.codecs)); |
`
`
std::vectorWebRtcVideoChannel::SelectSendVideoCodecs( const std::vector& remote_mapped_codecs) const { std::vector sdp_formats = encoder_factory_ ? encoder_factory_->GetImplementations() : std::vector(); |
`
`
std::vectorNebulaVideoEncoderFactory::GetSupportedFormats() const { NSLog(@"yinyinyin NebulaVideoEncoderFactory::GetSupportedFormats "); std::vector supported_formats; for (RTC_OBJC_TYPE(RTCVideoCodecInfo) * supportedCodec in [encoder_factory_ supportedCodecs]) { SdpVideoFormat format = [supportedCodec nativeSdpVideoFormat]; supported_formats.push_back(format); } for (const webrtc::SdpVideoFormat &format : SupportedX264Codecs()) supported_formats.push_back(format); return supported_formats;} |
`
`
+ (NSArray *)supportedCodecs { NSDictionary *constrainedHighParams = @{ @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedHigh, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; RTC_OBJC_TYPE(RTCVideoCodecInfo) *constrainedHighInfo = [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH264Name parameters:constrainedHighParams]; NSDictionary *constrainedBaselineParams = @{ @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; RTC_OBJC_TYPE(RTCVideoCodecInfo) *constrainedBaselineInfo = [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH264Name parameters:constrainedBaselineParams];#if defined(WEBRTC_MAC) NSDictionary *constrainedMainParams = @{ @"profile-level-id" : kRTCSupportedH264ProfileLevelConstrainedMain, @"level-asymmetry-allowed" : @"1", @"packetization-mode" : @"1", }; RTC_OBJC_TYPE(RTCVideoCodecInfo) *constrainedMainInfo = [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH264Name parameters:constrainedMainParams];#endif RTC_OBJC_TYPE(RTCVideoCodecInfo) *vp8Info = [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecVp8Name]; NSMutableArray *result = [@[ constrainedHighInfo, constrainedBaselineInfo,#if defined(WEBRTC_MAC) constrainedMainInfo,#endif vp8Info, ] mutableCopy]; if ([RTC_OBJC_TYPE(RTCVideoEncoderVP9) isSupported]) { [result addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecVp9Name]]; }#if defined(RTC_USE_LIBAOM_AV1_ENCODER) [result addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecAv1Name]];#endif #ifdef WEBRTC_USE_H265 RTC_OBJC_TYPE(RTCVideoCodecInfo) *h265Info = [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH265Name]; [result addObject:h265Info];#endif return result;} |