Add retransmission_allowed flag to encoder output
Using this flag, an encoder may inform the RTP sender module that the packet is not elligible for retransmission. Specifically, it may not be retransmitted in response to a NACK message, nor because of early loss detection (see CL #135881). Bug: webrtc:10702 Change-Id: Ib6a9cc361cf10ea7214cf672e05940c27899a6be Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140105 Commit-Queue: Elad Alon <eladalon@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28169}
This commit is contained in:
@ -941,12 +941,16 @@ int LibvpxVp8Encoder::Encode(const VideoFrame& frame,
|
||||
|
||||
bool send_key_frame = key_frame_requested;
|
||||
bool drop_frame = false;
|
||||
bool retransmission_allowed = true;
|
||||
Vp8FrameConfig tl_configs[kMaxSimulcastStreams];
|
||||
for (size_t i = 0; i < encoders_.size(); ++i) {
|
||||
tl_configs[i] =
|
||||
frame_buffer_controller_->NextFrameConfig(i, frame.timestamp());
|
||||
send_key_frame |= tl_configs[i].IntraFrame();
|
||||
drop_frame |= tl_configs[i].drop_frame;
|
||||
RTC_DCHECK(i == 0 ||
|
||||
retransmission_allowed == tl_configs[i].retransmission_allowed);
|
||||
retransmission_allowed = tl_configs[i].retransmission_allowed;
|
||||
}
|
||||
|
||||
if (drop_frame && !send_key_frame) {
|
||||
@ -1065,7 +1069,7 @@ int LibvpxVp8Encoder::Encode(const VideoFrame& frame,
|
||||
if (error)
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
// Examines frame timestamps only.
|
||||
error = GetEncodedPartitions(frame);
|
||||
error = GetEncodedPartitions(frame, retransmission_allowed);
|
||||
}
|
||||
// TODO(sprang): Shouldn't we use the frame timestamp instead?
|
||||
timestamp_ += duration;
|
||||
@ -1091,7 +1095,8 @@ void LibvpxVp8Encoder::PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
|
||||
(pkt.data.frame.flags & VPX_FRAME_IS_KEY) != 0, qp, codec_specific);
|
||||
}
|
||||
|
||||
int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image) {
|
||||
int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image,
|
||||
bool retransmission_allowed) {
|
||||
int stream_idx = static_cast<int>(encoders_.size()) - 1;
|
||||
int result = WEBRTC_VIDEO_CODEC_OK;
|
||||
for (size_t encoder_idx = 0; encoder_idx < encoders_.size();
|
||||
@ -1139,6 +1144,8 @@ int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image) {
|
||||
: VideoContentType::UNSPECIFIED;
|
||||
encoded_images_[encoder_idx].timing_.flags = VideoSendTiming::kInvalid;
|
||||
encoded_images_[encoder_idx].SetColorSpace(input_image.color_space());
|
||||
encoded_images_[encoder_idx].SetRetransmissionAllowed(
|
||||
retransmission_allowed);
|
||||
|
||||
if (send_stream_[stream_idx]) {
|
||||
if (encoded_images_[encoder_idx].size() > 0) {
|
||||
|
||||
@ -82,7 +82,8 @@ class LibvpxVp8Encoder : public VideoEncoder {
|
||||
int encoder_idx,
|
||||
uint32_t timestamp);
|
||||
|
||||
int GetEncodedPartitions(const VideoFrame& input_image);
|
||||
int GetEncodedPartitions(const VideoFrame& input_image,
|
||||
bool retransmission_allowed);
|
||||
|
||||
// Set the stream state for stream |stream_idx|.
|
||||
void SetStreamState(bool send_stream, int stream_idx);
|
||||
|
||||
Reference in New Issue
Block a user