diff --git a/api/video/video_stream_encoder_settings.h b/api/video/video_stream_encoder_settings.h index a8f2c7b6ff..c8cb368ce7 100644 --- a/api/video/video_stream_encoder_settings.h +++ b/api/video/video_stream_encoder_settings.h @@ -53,6 +53,10 @@ struct VideoStreamEncoderSettings { // Negotiated capabilities which the VideoEncoder may expect the other // side to use. VideoEncoder::Capabilities capabilities; + + // Enables the frame instrumentation generator that is required for automatic + // corruption detection. + bool enable_frame_instrumentation_generator = false; }; } // namespace webrtc diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc index 248d1f9736..9c72d044a6 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc @@ -30,6 +30,7 @@ #include "api/media_types.h" #include "api/priority.h" #include "api/rtc_error.h" +#include "api/rtp_parameters.h" #include "api/rtp_transceiver_direction.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" @@ -44,7 +45,9 @@ #include "call/call.h" #include "call/packet_receiver.h" #include "call/receive_stream.h" +#include "call/rtp_config.h" #include "call/rtp_transport_controller_send_interface.h" +#include "call/video_send_stream.h" #include "common_video/frame_counts.h" #include "common_video/include/quality_limitation_reason.h" #include "media/base/codec.h" @@ -1489,6 +1492,13 @@ bool WebRtcVideoSendChannel::AddSendStream(const StreamParams& sp) { config.encoder_settings.bitrate_allocator_factory = bitrate_allocator_factory_; config.encoder_settings.encoder_switch_request_callback = this; + + // TODO: b/358039777 - Add test when this effectively does something. + if (webrtc::RtpExtension::FindHeaderExtensionByUri( + config.rtp.extensions, webrtc::RtpExtension::kCorruptionDetectionUri, + webrtc::RtpExtension::kRequireEncryptedExtension)) { + config.encoder_settings.enable_frame_instrumentation_generator = true; + } config.crypto_options = crypto_options_; config.rtp.extmap_allow_mixed = ExtmapAllowMixed(); config.rtcp_report_interval_ms = video_config_.rtcp_report_interval_ms;