H.264 temporal layers w/frame marking (PART 2/3)

Bug: None
Change-Id: Id1381d895377d39c3969635e1a59591214aabb71
Reviewed-on: https://webrtc-review.googlesource.com/c/86140
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26624}
This commit is contained in:
Johnny Lee
2019-02-08 14:25:40 -05:00
committed by Commit Bot
parent e556768453
commit 1a1c52baf9
19 changed files with 222 additions and 21 deletions

View File

@ -144,14 +144,18 @@ TEST(RtpPayloadParamsTest, InfoMappedToRtpVideoHeader_Vp9) {
}
TEST(RtpPayloadParamsTest, InfoMappedToRtpVideoHeader_H264) {
RtpPayloadParams params(kSsrc1, {});
RtpPayloadState state;
state.picture_id = kPictureId;
state.tl0_pic_idx = kInitialTl0PicIdx1;
RtpPayloadParams params(kSsrc1, &state);
EncodedImage encoded_image;
CodecSpecificInfo codec_info;
CodecSpecificInfoH264 *h264info = &codec_info.codecSpecific.H264;
memset(&codec_info, 0, sizeof(CodecSpecificInfo));
codec_info.codecType = kVideoCodecH264;
codec_info.codecSpecific.H264.packetization_mode =
H264PacketizationMode::SingleNalUnit;
h264info->packetization_mode = H264PacketizationMode::SingleNalUnit;
h264info->temporal_idx = kNoTemporalIdx;
RTPVideoHeader header =
params.GetRtpVideoHeader(encoded_image, &codec_info, kDontCare);
@ -160,6 +164,32 @@ TEST(RtpPayloadParamsTest, InfoMappedToRtpVideoHeader_H264) {
EXPECT_EQ(kVideoCodecH264, header.codec);
const auto& h264 = absl::get<RTPVideoHeaderH264>(header.video_type_header);
EXPECT_EQ(H264PacketizationMode::SingleNalUnit, h264.packetization_mode);
// test temporal param 1
h264info->temporal_idx = 1;
h264info->base_layer_sync = true;
h264info->idr_frame = false;
header = params.GetRtpVideoHeader(encoded_image, &codec_info, kDontCare);
EXPECT_EQ(kVideoCodecH264, header.codec);
EXPECT_EQ(header.frame_marking.tl0_pic_idx, kInitialTl0PicIdx1);
EXPECT_EQ(header.frame_marking.temporal_id, h264info->temporal_idx);
EXPECT_EQ(header.frame_marking.base_layer_sync, h264info->base_layer_sync);
EXPECT_EQ(header.frame_marking.independent_frame, h264info->idr_frame);
// test temporal param 2
h264info->temporal_idx = 0;
h264info->base_layer_sync = false;
h264info->idr_frame = true;
header = params.GetRtpVideoHeader(encoded_image, &codec_info, kDontCare);
EXPECT_EQ(kVideoCodecH264, header.codec);
EXPECT_EQ(header.frame_marking.tl0_pic_idx, kInitialTl0PicIdx1 + 1);
EXPECT_EQ(header.frame_marking.temporal_id, h264info->temporal_idx);
EXPECT_EQ(header.frame_marking.base_layer_sync, h264info->base_layer_sync);
EXPECT_EQ(header.frame_marking.independent_frame, h264info->idr_frame);
}
TEST(RtpPayloadParamsTest, PictureIdIsSetForVp8) {