Enable the FrameInstrumentationGenerator if its extension is negotiated
Bug: webrtc:358039777
Change-Id: I5d1181d174e3e23506baa7f168849f02922311b5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361580
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42947}
diff --git a/api/video/video_stream_encoder_settings.h b/api/video/video_stream_encoder_settings.h
index a8f2c7b..c8cb368 100644
--- a/api/video/video_stream_encoder_settings.h
+++ b/api/video/video_stream_encoder_settings.h
@@ -53,6 +53,10 @@
// 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 248d1f9..9c72d04 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 @@
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;