Fix maybe incorrect spatial id when reading corruption detection message
In addition, avoid empty conversion when no message is present. Bug: chromium:379326016 Change-Id: I855069fa89a157ba862b5162c56858825ebc1a40 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370160 Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Auto-Submit: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43487}
This commit is contained in:
parent
ae1ad04077
commit
94f2b91f11
@ -616,36 +616,49 @@ bool RtpVideoStreamReceiver2::OnReceivedPayloadData(
|
|||||||
} else if (last_color_space_) {
|
} else if (last_color_space_) {
|
||||||
video_header.color_space = last_color_space_;
|
video_header.color_space = last_color_space_;
|
||||||
}
|
}
|
||||||
CorruptionDetectionMessage message;
|
|
||||||
rtp_packet.GetExtension<CorruptionDetectionExtension>(&message);
|
std::optional<int> spatial_id;
|
||||||
int spatial_idx = 0;
|
|
||||||
if (video_header.generic.has_value()) {
|
if (video_header.generic.has_value()) {
|
||||||
spatial_idx = video_header.generic->spatial_index;
|
spatial_id = video_header.generic->spatial_index;
|
||||||
|
if (spatial_id >= kMaxSpatialLayers) {
|
||||||
|
RTC_LOG(LS_WARNING) << "Invalid spatial id: " << *spatial_id
|
||||||
|
<< ". Ignoring corruption detection mesaage.";
|
||||||
|
spatial_id.reset();
|
||||||
}
|
}
|
||||||
if (message.sample_values().empty()) {
|
} else {
|
||||||
|
spatial_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CorruptionDetectionMessage> message =
|
||||||
|
rtp_packet.GetExtension<CorruptionDetectionExtension>();
|
||||||
|
if (message.has_value() && spatial_id.has_value()) {
|
||||||
|
if (message->sample_values().empty()) {
|
||||||
video_header.frame_instrumentation_data =
|
video_header.frame_instrumentation_data =
|
||||||
ConvertCorruptionDetectionMessageToFrameInstrumentationSyncData(
|
ConvertCorruptionDetectionMessageToFrameInstrumentationSyncData(
|
||||||
message, last_corruption_detection_state_by_layer_[spatial_idx]
|
*message, last_corruption_detection_state_by_layer_[*spatial_id]
|
||||||
.sequence_index);
|
.sequence_index);
|
||||||
} else {
|
} else {
|
||||||
// `OnReceivedPayloadData` might be called several times, however, we
|
// `OnReceivedPayloadData` might be called several times, however, we
|
||||||
// don't want to increase the sequence index each time.
|
// don't want to increase the sequence index each time.
|
||||||
if (!last_corruption_detection_state_by_layer_[spatial_idx]
|
if (!last_corruption_detection_state_by_layer_[*spatial_id]
|
||||||
.timestamp.has_value() ||
|
.timestamp.has_value() ||
|
||||||
rtp_packet.Timestamp() !=
|
rtp_packet.Timestamp() !=
|
||||||
last_corruption_detection_state_by_layer_[spatial_idx]
|
last_corruption_detection_state_by_layer_[*spatial_id]
|
||||||
.timestamp) {
|
.timestamp) {
|
||||||
video_header.frame_instrumentation_data =
|
video_header.frame_instrumentation_data =
|
||||||
ConvertCorruptionDetectionMessageToFrameInstrumentationData(
|
ConvertCorruptionDetectionMessageToFrameInstrumentationData(
|
||||||
message, last_corruption_detection_state_by_layer_[spatial_idx]
|
*message,
|
||||||
|
last_corruption_detection_state_by_layer_[*spatial_id]
|
||||||
.sequence_index);
|
.sequence_index);
|
||||||
last_corruption_detection_state_by_layer_[spatial_idx].timestamp =
|
last_corruption_detection_state_by_layer_[*spatial_id].timestamp =
|
||||||
rtp_packet.Timestamp();
|
rtp_packet.Timestamp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video_header.frame_instrumentation_data.has_value()) {
|
if (video_header.frame_instrumentation_data.has_value()) {
|
||||||
SetLastCorruptionDetectionIndex(*video_header.frame_instrumentation_data,
|
SetLastCorruptionDetectionIndex(
|
||||||
spatial_idx);
|
*video_header.frame_instrumentation_data, *spatial_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
video_header.video_frame_tracking_id =
|
video_header.video_frame_tracking_id =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user