add RTCRtpSender.generateKeyFrame
defined in
https://w3c.github.io/webrtc-encoded-transform/#rtcrtpsender-extension
Note: this does not implement the "rid(s)" parameter which will be done in a future CL.
VP8 still synchronizes keyframes on all layers even when asked for ones on individual layers while H264 (when implemented as three different encoders in SimulcastEncoderAdapter) can actually utilize this.
This does not change the behavior when receiving a RTCP PLI for a particular layer.
BUG=chromium:1354101
Change-Id: Ic8b14d155242e32c9aeafa55fe6652f346ac76b8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274169
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#38472}
diff --git a/pc/rtp_sender.cc b/pc/rtp_sender.cc
index 753ac2f..98e86b3 100644
--- a/pc/rtp_sender.cc
+++ b/pc/rtp_sender.cc
@@ -596,6 +596,13 @@
return dtmf_sender_proxy_;
}
+RTCError AudioRtpSender::GenerateKeyFrame() {
+ RTC_DCHECK_RUN_ON(signaling_thread_);
+ RTC_DLOG(LS_ERROR) << "Tried to get generate a key frame for audio.";
+ return RTCError(RTCErrorType::UNSUPPORTED_OPERATION,
+ "Generating key frames for audio is not supported.");
+}
+
void AudioRtpSender::SetSend() {
RTC_DCHECK_RUN_ON(signaling_thread_);
RTC_DCHECK(!stopped_);
@@ -686,6 +693,18 @@
return nullptr;
}
+RTCError VideoRtpSender::GenerateKeyFrame() {
+ RTC_DCHECK_RUN_ON(signaling_thread_);
+ if (video_media_channel() && ssrc_ && !stopped_) {
+ worker_thread_->PostTask(
+ [&] { video_media_channel()->GenerateSendKeyFrame(ssrc_); });
+ } else {
+ RTC_LOG(LS_WARNING) << "Tried to generate key frame for sender that is "
+ "stopped or has no media channel.";
+ }
+ return RTCError::OK();
+}
+
void VideoRtpSender::SetSend() {
RTC_DCHECK_RUN_ON(signaling_thread_);
RTC_DCHECK(!stopped_);