Implement RTCRtpTransceiver.setCodecPreferences
SetCodecPreferences allows clients to filter and reorder codecs in their
SDP offer and answer.
Bug: webrtc:9777
Change-Id: I716bed9b06496629b45210883b286f599c875239
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129727
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27817}
diff --git a/pc/rtp_transceiver.h b/pc/rtp_transceiver.h
index 2c04bd7..990c3cc 100644
--- a/pc/rtp_transceiver.h
+++ b/pc/rtp_transceiver.h
@@ -16,6 +16,7 @@
#include "api/rtp_transceiver_interface.h"
#include "pc/channel_interface.h"
+#include "pc/channel_manager.h"
#include "pc/rtp_receiver.h"
#include "pc/rtp_sender.h"
@@ -66,7 +67,8 @@
RtpTransceiver(
rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> sender,
rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>
- receiver);
+ receiver,
+ cricket::ChannelManager* channel_manager);
~RtpTransceiver() override;
// Returns the Voice/VideoChannel set for this transceiver. May be null if
@@ -175,7 +177,11 @@
absl::optional<RtpTransceiverDirection> current_direction() const override;
absl::optional<RtpTransceiverDirection> fired_direction() const override;
void Stop() override;
- void SetCodecPreferences(rtc::ArrayView<RtpCodecCapability> codecs) override;
+ RTCError SetCodecPreferences(
+ rtc::ArrayView<RtpCodecCapability> codecs) override;
+ std::vector<RtpCodecCapability> codec_preferences() const override {
+ return codec_preferences_;
+ }
private:
void OnFirstPacketReceived(cricket::ChannelInterface* channel);
@@ -198,6 +204,8 @@
bool has_ever_been_used_to_send_ = false;
cricket::ChannelInterface* channel_ = nullptr;
+ cricket::ChannelManager* channel_manager_ = nullptr;
+ std::vector<RtpCodecCapability> codec_preferences_;
};
BEGIN_SIGNALING_PROXY_MAP(RtpTransceiver)
@@ -212,7 +220,10 @@
PROXY_CONSTMETHOD0(absl::optional<RtpTransceiverDirection>, current_direction)
PROXY_CONSTMETHOD0(absl::optional<RtpTransceiverDirection>, fired_direction)
PROXY_METHOD0(void, Stop)
-PROXY_METHOD1(void, SetCodecPreferences, rtc::ArrayView<RtpCodecCapability>)
+PROXY_METHOD1(webrtc::RTCError,
+ SetCodecPreferences,
+ rtc::ArrayView<RtpCodecCapability>)
+PROXY_CONSTMETHOD0(std::vector<RtpCodecCapability>, codec_preferences)
END_PROXY_MAP()
} // namespace webrtc