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}
diff --git a/modules/video_coding/decoding_state_unittest.cc b/modules/video_coding/decoding_state_unittest.cc
index 6aeeb64..a578900 100644
--- a/modules/video_coding/decoding_state_unittest.cc
+++ b/modules/video_coding/decoding_state_unittest.cc
@@ -38,7 +38,7 @@
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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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;