Correctly set first/last packet of frame bit in VideoRtpDepacketizerVp9.

Bug: none
Change-Id: I72911859b313add520f58e06f0529d082a0291aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237801
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35345}
This commit is contained in:
philipel 2021-11-15 16:22:29 +01:00 committed by WebRTC LUCI CQ
parent 60c01cc45b
commit 8718f58868
4 changed files with 9 additions and 10 deletions

View File

@ -211,8 +211,8 @@ int VideoRtpDepacketizerVp9::ParseRtpPayload(
video_header->height = vp9_header.height[0];
}
}
video_header->is_first_packet_in_frame =
b_bit && (!l_bit || !vp9_header.inter_layer_predicted);
video_header->is_first_packet_in_frame = b_bit;
video_header->is_last_packet_in_frame = e_bit;
int num_remaining_bits = parser.RemainingBitCount();
if (num_remaining_bits <= 0) {

View File

@ -279,6 +279,7 @@ TEST(VideoRtpDepacketizerVp9Test, ParseFirstPacketInKeyFrame) {
EXPECT_EQ(video_header.frame_type, VideoFrameType::kVideoFrameKey);
EXPECT_TRUE(video_header.is_first_packet_in_frame);
EXPECT_FALSE(video_header.is_last_packet_in_frame);
}
TEST(VideoRtpDepacketizerVp9Test, ParseLastPacketInDeltaFrame) {
@ -290,6 +291,7 @@ TEST(VideoRtpDepacketizerVp9Test, ParseLastPacketInDeltaFrame) {
EXPECT_EQ(video_header.frame_type, VideoFrameType::kVideoFrameDelta);
EXPECT_FALSE(video_header.is_first_packet_in_frame);
EXPECT_TRUE(video_header.is_last_packet_in_frame);
}
TEST(VideoRtpDepacketizerVp9Test, ParseResolution) {

View File

@ -503,12 +503,6 @@ void RtpVideoStreamReceiver2::OnReceivedPayloadData(
video_header.video_timing.flags = VideoSendTiming::kInvalid;
video_header.is_last_packet_in_frame |= rtp_packet.Marker();
if (const auto* vp9_header =
absl::get_if<RTPVideoHeaderVP9>(&video_header.video_type_header)) {
video_header.is_last_packet_in_frame |= vp9_header->end_of_frame;
video_header.is_first_packet_in_frame |= vp9_header->beginning_of_frame;
}
rtp_packet.GetExtension<VideoOrientation>(&video_header.rotation);
rtp_packet.GetExtension<VideoContentTypeExtension>(
&video_header.content_type);

View File

@ -3377,11 +3377,14 @@ class Vp9HeaderObserver : public test::SendTest {
const auto& vp9_header =
absl::get<RTPVideoHeaderVP9>(video.video_type_header);
bool new_frame =
const bool new_temporal_unit =
packets_sent_ == 0 ||
IsNewerTimestamp(rtp_packet.Timestamp(), last_packet_timestamp_);
const bool new_frame =
new_temporal_unit || last_vp9_.spatial_idx != vp9_header.spatial_idx;
EXPECT_EQ(new_frame, video.is_first_packet_in_frame);
if (!new_frame) {
if (!new_temporal_unit) {
EXPECT_FALSE(last_packet_marker_);
EXPECT_EQ(last_packet_timestamp_, rtp_packet.Timestamp());
EXPECT_EQ(last_vp9_.picture_id, vp9_header.picture_id);