Make VideoFrameType an enum class, and move to separate file and target
Bug: webrtc:5876, webrtc:6883 Change-Id: I1435cfa9e8e54c4ba2978261048ff3fbb993ce0e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126225 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27239}
This commit is contained in:
@ -38,7 +38,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.timestamp = 1;
|
||||
packet.seqNum = 0xffff;
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.codec = kVideoCodecVP8;
|
||||
auto& vp8_header =
|
||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
|
||||
@ -50,12 +50,12 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
// Always start with a key frame.
|
||||
dec_state.Reset();
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_LE(0, frame_key.InsertPacket(packet, 0, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame_key));
|
||||
dec_state.SetState(&frame);
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
// Use pictureId
|
||||
packet.video_header.is_first_packet_in_frame = false;
|
||||
vp8_header.pictureId = 0x0002;
|
||||
@ -171,7 +171,7 @@ TEST(TestDecodingState, UpdateOldPacket) {
|
||||
VCMPacket packet;
|
||||
packet.timestamp = 1;
|
||||
packet.seqNum = 1;
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
FrameData frame_data;
|
||||
frame_data.rtt_ms = 0;
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
@ -186,14 +186,14 @@ TEST(TestDecodingState, UpdateOldPacket) {
|
||||
// Now insert empty packet belonging to the same frame.
|
||||
packet.timestamp = 1;
|
||||
packet.seqNum = 2;
|
||||
packet.frameType = kEmptyFrame;
|
||||
packet.frameType = VideoFrameType::kEmptyFrame;
|
||||
packet.sizeBytes = 0;
|
||||
dec_state.UpdateOldPacket(&packet);
|
||||
EXPECT_EQ(dec_state.sequence_num(), 2);
|
||||
// Now insert delta packet belonging to the same frame.
|
||||
packet.timestamp = 1;
|
||||
packet.seqNum = 3;
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.sizeBytes = 1400;
|
||||
dec_state.UpdateOldPacket(&packet);
|
||||
EXPECT_EQ(dec_state.sequence_num(), 3);
|
||||
@ -201,7 +201,7 @@ TEST(TestDecodingState, UpdateOldPacket) {
|
||||
// sequence number.
|
||||
packet.timestamp = 0;
|
||||
packet.seqNum = 4;
|
||||
packet.frameType = kEmptyFrame;
|
||||
packet.frameType = VideoFrameType::kEmptyFrame;
|
||||
packet.sizeBytes = 0;
|
||||
dec_state.UpdateOldPacket(&packet);
|
||||
EXPECT_EQ(dec_state.sequence_num(), 3);
|
||||
@ -215,7 +215,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
// tl0PicIdx 0, temporal id 0.
|
||||
VCMFrameBuffer frame;
|
||||
VCMPacket packet;
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.codec = kVideoCodecVP8;
|
||||
packet.timestamp = 0;
|
||||
packet.seqNum = 0;
|
||||
@ -266,7 +266,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
// Insert key frame - should update sync value.
|
||||
// A key frame is always a base layer.
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.timestamp = 5;
|
||||
packet.seqNum = 5;
|
||||
@ -280,7 +280,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
// After sync, a continuous PictureId is required
|
||||
// (continuous base layer is not enough )
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.timestamp = 6;
|
||||
packet.seqNum = 6;
|
||||
vp8_header.tl0PicIdx = 3;
|
||||
@ -290,7 +290,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.timestamp = 8;
|
||||
packet.seqNum = 8;
|
||||
@ -305,7 +305,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
|
||||
// Insert a non-ref frame - should update sync value.
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.timestamp = 9;
|
||||
packet.seqNum = 9;
|
||||
@ -325,7 +325,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
// Base layer.
|
||||
frame.Reset();
|
||||
dec_state.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.markerBit = 1;
|
||||
packet.timestamp = 0;
|
||||
@ -339,7 +339,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
// Layer 2 - 2 packets (insert one, lose one).
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.markerBit = 0;
|
||||
packet.timestamp = 1;
|
||||
@ -352,7 +352,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
// Layer 1
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.is_first_packet_in_frame = true;
|
||||
packet.markerBit = 1;
|
||||
packet.timestamp = 2;
|
||||
@ -371,7 +371,7 @@ TEST(TestDecodingState, DiscontinuousPicIdContinuousSeqNum) {
|
||||
VCMFrameBuffer frame;
|
||||
VCMPacket packet;
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
packet.video_header.codec = kVideoCodecVP8;
|
||||
packet.timestamp = 0;
|
||||
packet.seqNum = 0;
|
||||
@ -390,7 +390,7 @@ TEST(TestDecodingState, DiscontinuousPicIdContinuousSeqNum) {
|
||||
// Continuous sequence number but discontinuous picture id. This implies a
|
||||
// a loss and we have to fall back to only decoding the base layer.
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.timestamp += 3000;
|
||||
++packet.seqNum;
|
||||
vp8_header.temporalIdx = 1;
|
||||
@ -426,7 +426,7 @@ TEST(TestDecodingState, PictureIdRepeat) {
|
||||
VCMDecodingState dec_state;
|
||||
VCMFrameBuffer frame;
|
||||
VCMPacket packet;
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
packet.video_header.codec = kVideoCodecVP8;
|
||||
packet.timestamp = 0;
|
||||
packet.seqNum = 0;
|
||||
@ -479,7 +479,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeKeyFrame) {
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
|
||||
// Key frame as first frame
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
@ -493,7 +493,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeKeyFrame) {
|
||||
|
||||
// Ref to 11, continuous
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
vp9_hdr.picture_id = 12;
|
||||
vp9_hdr.num_ref_pics = 1;
|
||||
vp9_hdr.pid_diff[0] = 1;
|
||||
@ -523,14 +523,14 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeOutOfOrderFrames) {
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
|
||||
// Key frame as first frame
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
|
||||
// Ref to 10, continuous
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
vp9_hdr.picture_id = 15;
|
||||
vp9_hdr.num_ref_pics = 1;
|
||||
vp9_hdr.pid_diff[0] = 5;
|
||||
@ -579,23 +579,23 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
|
||||
// Key frame as first frame
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
|
||||
// Delta frame as first frame
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
|
||||
// Key frame then delta frame
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
vp9_hdr.num_ref_pics = 1;
|
||||
vp9_hdr.picture_id = 15;
|
||||
vp9_hdr.pid_diff[0] = 5;
|
||||
@ -639,7 +639,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
|
||||
|
||||
// Key Frame, continuous
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
vp9_hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 2;
|
||||
vp9_hdr.num_ref_pics = 0;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
@ -648,7 +648,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
|
||||
|
||||
// Frame at last index, ref to KF, continuous
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
vp9_hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 1;
|
||||
vp9_hdr.num_ref_pics = 1;
|
||||
vp9_hdr.pid_diff[0] = 1;
|
||||
@ -684,7 +684,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
|
||||
|
||||
// Key frame, continuous
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameKey;
|
||||
packet.frameType = VideoFrameType::kVideoFrameKey;
|
||||
vp9_hdr.picture_id = 25;
|
||||
vp9_hdr.num_ref_pics = 0;
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||
@ -693,7 +693,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
|
||||
|
||||
// Ref to KF, continuous
|
||||
frame.Reset();
|
||||
packet.frameType = kVideoFrameDelta;
|
||||
packet.frameType = VideoFrameType::kVideoFrameDelta;
|
||||
vp9_hdr.picture_id = 26;
|
||||
vp9_hdr.num_ref_pics = 1;
|
||||
vp9_hdr.pid_diff[0] = 1;
|
||||
|
Reference in New Issue
Block a user