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}
This commit is contained in:
Fanny Linderborg 2024-09-04 09:55:52 +02:00 committed by WebRTC LUCI CQ
parent 6e5eaea163
commit ac505c5b9a
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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;