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:
@ -209,7 +209,7 @@ int LibvpxVp8Decoder::Decode(const EncodedImage& input_image,
|
||||
|
||||
// Always start with a complete key frame.
|
||||
if (key_frame_required_) {
|
||||
if (input_image._frameType != kVideoFrameKey)
|
||||
if (input_image._frameType != VideoFrameType::kVideoFrameKey)
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
// We have a key frame - is it complete?
|
||||
if (input_image._completeFrame) {
|
||||
@ -220,7 +220,8 @@ int LibvpxVp8Decoder::Decode(const EncodedImage& input_image,
|
||||
}
|
||||
// Restrict error propagation using key frame requests.
|
||||
// Reset on a key frame refresh.
|
||||
if (input_image._frameType == kVideoFrameKey && input_image._completeFrame) {
|
||||
if (input_image._frameType == VideoFrameType::kVideoFrameKey &&
|
||||
input_image._completeFrame) {
|
||||
propagation_cnt_ = -1;
|
||||
// Start count on first loss.
|
||||
} else if ((!input_image._completeFrame || missing_frames) &&
|
||||
|
||||
@ -756,7 +756,8 @@ int LibvpxVp8Encoder::Encode(const VideoFrame& frame,
|
||||
if (!send_key_frame && frame_types) {
|
||||
for (size_t i = 0; i < frame_types->size() && i < send_stream_.size();
|
||||
++i) {
|
||||
if ((*frame_types)[i] == kVideoFrameKey && send_stream_[i]) {
|
||||
if ((*frame_types)[i] == VideoFrameType::kVideoFrameKey &&
|
||||
send_stream_[i]) {
|
||||
send_key_frame = true;
|
||||
break;
|
||||
}
|
||||
@ -925,7 +926,7 @@ int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image) {
|
||||
++encoder_idx, --stream_idx) {
|
||||
vpx_codec_iter_t iter = NULL;
|
||||
encoded_images_[encoder_idx].set_size(0);
|
||||
encoded_images_[encoder_idx]._frameType = kVideoFrameDelta;
|
||||
encoded_images_[encoder_idx]._frameType = VideoFrameType::kVideoFrameDelta;
|
||||
CodecSpecificInfo codec_specific;
|
||||
const vpx_codec_cx_pkt_t* pkt = NULL;
|
||||
while ((pkt = libvpx_->codec_get_cx_data(&encoders_[encoder_idx], &iter)) !=
|
||||
@ -947,7 +948,8 @@ int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image) {
|
||||
if ((pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT) == 0) {
|
||||
// check if encoded frame is a key frame
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
encoded_images_[encoder_idx]._frameType = kVideoFrameKey;
|
||||
encoded_images_[encoder_idx]._frameType =
|
||||
VideoFrameType::kVideoFrameKey;
|
||||
}
|
||||
encoded_images_[encoder_idx].SetSpatialIndex(stream_idx);
|
||||
PopulateCodecSpecific(&codec_specific, *pkt, stream_idx, encoder_idx,
|
||||
|
||||
@ -209,7 +209,7 @@ TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
|
||||
EncodeAndWaitForFrame(*input_frame, &encoded_frame, &codec_specific_info);
|
||||
|
||||
// First frame should be a key frame.
|
||||
encoded_frame._frameType = kVideoFrameKey;
|
||||
encoded_frame._frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
std::unique_ptr<VideoFrame> decoded_frame;
|
||||
@ -323,7 +323,7 @@ TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
|
||||
EncodeAndWaitForFrame(*input_frame, &encoded_frame, &codec_specific_info);
|
||||
|
||||
// First frame should be a key frame.
|
||||
encoded_frame._frameType = kVideoFrameKey;
|
||||
encoded_frame._frameType = VideoFrameType::kVideoFrameKey;
|
||||
encoded_frame.ntp_time_ms_ = kTestNtpTimeMs;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
@ -354,12 +354,12 @@ TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
// Setting complete back to true. Forcing a delta frame.
|
||||
encoded_frame._frameType = kVideoFrameDelta;
|
||||
encoded_frame._frameType = VideoFrameType::kVideoFrameDelta;
|
||||
encoded_frame._completeFrame = true;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
// Now setting a key frame.
|
||||
encoded_frame._frameType = kVideoFrameKey;
|
||||
encoded_frame._frameType = VideoFrameType::kVideoFrameKey;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
std::unique_ptr<VideoFrame> decoded_frame;
|
||||
@ -484,7 +484,8 @@ TEST_F(TestVp8Impl, KeepsTimestampOnReencode) {
|
||||
.Times(2)
|
||||
.WillRepeatedly(Return(vpx_codec_err_t::VPX_CODEC_OK));
|
||||
|
||||
auto delta_frame = std::vector<VideoFrameType>{kVideoFrameDelta};
|
||||
auto delta_frame =
|
||||
std::vector<VideoFrameType>{VideoFrameType::kVideoFrameDelta};
|
||||
encoder.Encode(*NextInputFrame(), &delta_frame);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user