Add VideoProcessor tests verifying that H.264 keyframes contain SPS/PPS/IDR.
This CL adds an EncodedFrameChecker interface which can be used by users of the VideoProcessor to inject customized per-frame checks to the encoding/decoding pipeline. This currently has two uses: - Verifying that the QP parser works correctly for VP8 and VP9, by comparing the parsed QP to that produced by libvpx. - Verifying that our H.264 encoders always produce SPS/PPS/IDR in tandem. TESTED=Galaxy S8, Pixel 2 XL, iPhone 7. BUG=webrtc:8423 Change-Id: Ic3e401546e239a9ffaf2ed2907689cebb1127805 Reviewed-on: https://webrtc-review.googlesource.com/14559 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20409}
This commit is contained in:
committed by
Commit Bot
parent
edf4ff7e0f
commit
f7a3558f3e
@ -76,8 +76,43 @@ bool RunEncodeInRealTime(const TestConfig& config) {
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void VideoProcessorIntegrationTest::H264KeyframeChecker::CheckEncodedFrame(
|
||||
webrtc::VideoCodecType codec,
|
||||
const EncodedImage& encoded_frame) const {
|
||||
EXPECT_EQ(kVideoCodecH264, codec);
|
||||
bool contains_sps = false;
|
||||
bool contains_pps = false;
|
||||
bool contains_idr = false;
|
||||
const std::vector<webrtc::H264::NaluIndex> nalu_indices =
|
||||
webrtc::H264::FindNaluIndices(encoded_frame._buffer,
|
||||
encoded_frame._length);
|
||||
for (const webrtc::H264::NaluIndex& index : nalu_indices) {
|
||||
webrtc::H264::NaluType nalu_type = webrtc::H264::ParseNaluType(
|
||||
encoded_frame._buffer[index.payload_start_offset]);
|
||||
if (nalu_type == webrtc::H264::NaluType::kSps) {
|
||||
contains_sps = true;
|
||||
} else if (nalu_type == webrtc::H264::NaluType::kPps) {
|
||||
contains_pps = true;
|
||||
} else if (nalu_type == webrtc::H264::NaluType::kIdr) {
|
||||
contains_idr = true;
|
||||
}
|
||||
}
|
||||
if (encoded_frame._frameType == kVideoFrameKey) {
|
||||
EXPECT_TRUE(contains_sps) << "Keyframe should contain SPS.";
|
||||
EXPECT_TRUE(contains_pps) << "Keyframe should contain PPS.";
|
||||
EXPECT_TRUE(contains_idr) << "Keyframe should contain IDR.";
|
||||
} else if (encoded_frame._frameType == kVideoFrameDelta) {
|
||||
EXPECT_FALSE(contains_sps) << "Delta frame should not contain SPS.";
|
||||
EXPECT_FALSE(contains_pps) << "Delta frame should not contain PPS.";
|
||||
EXPECT_FALSE(contains_idr) << "Delta frame should not contain IDR.";
|
||||
} else {
|
||||
RTC_NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
class VideoProcessorIntegrationTest::CpuProcessTime final {
|
||||
public:
|
||||
explicit CpuProcessTime(const TestConfig& config) : config_(config) {}
|
||||
|
||||
Reference in New Issue
Block a user