generateKeyFrame: validate rids argument

BUG=chromium:1354101

Change-Id: Ie850d807e47c72470a50daffec5679c7a23111dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282380
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38591}
This commit is contained in:
Philipp Hancke
2022-11-09 11:06:38 +01:00
committed by WebRTC LUCI CQ
parent e4c1b1cbed
commit b83cd92a1a
2 changed files with 44 additions and 2 deletions

View File

@ -1468,6 +1468,36 @@ TEST_F(RtpSenderReceiverTest, VideoReceiverCanGetParametersWithSimulcast) {
DestroyVideoRtpReceiver();
}
TEST_F(RtpSenderReceiverTest, GenerateKeyFrameWithAudio) {
CreateAudioRtpSender();
auto error = audio_rtp_sender_->GenerateKeyFrame({});
EXPECT_FALSE(error.ok());
EXPECT_EQ(error.type(), RTCErrorType::UNSUPPORTED_OPERATION);
DestroyAudioRtpSender();
}
TEST_F(RtpSenderReceiverTest, GenerateKeyFrameWithVideo) {
CreateVideoRtpSenderWithSimulcast({"1", "2", "3"});
auto error = video_rtp_sender_->GenerateKeyFrame({});
EXPECT_TRUE(error.ok());
error = video_rtp_sender_->GenerateKeyFrame({"1"});
EXPECT_TRUE(error.ok());
error = video_rtp_sender_->GenerateKeyFrame({""});
EXPECT_FALSE(error.ok());
EXPECT_EQ(error.type(), RTCErrorType::INVALID_PARAMETER);
error = video_rtp_sender_->GenerateKeyFrame({"no-such-rid"});
EXPECT_FALSE(error.ok());
EXPECT_EQ(error.type(), RTCErrorType::INVALID_PARAMETER);
DestroyVideoRtpSender();
}
// Test that makes sure that a video track content hint translates to the proper
// value for sources that are not screencast.
TEST_F(RtpSenderReceiverTest, PropagatesVideoTrackContentHint) {