Adding test for SingleNalUnit mode

Test enables single-nalu mode, sets limit for nalu lenght and verifies
that encoder follows that limit.
I found that QP jumps significantly when the mode is enabled. In result
encoder might produce 4kbyte and 0.4kbyte frames back-to-back. But it
seems that happens only to couple of frames in the beginning. This
caused test to fail with default RC thresholds. To bypass this I
increased frame size mismatch threshold from 20 to 30%. This should be
Ok considering single-nalu mode is rare.

BUG=webrtc:8070

Review-Url: https://codereview.webrtc.org/3014623002
Cr-Commit-Position: refs/heads/master@{#20023}
This commit is contained in:
ssilkin
2017-09-28 09:23:17 -07:00
committed by Commit Bot
parent 0cbaf1a6f6
commit 612f858ba0
10 changed files with 103 additions and 17 deletions

View File

@ -176,6 +176,7 @@ void VideoProcessorIntegrationTest::ProcessFramesAndMaybeVerify(
const RateProfile& rate_profile,
const std::vector<RateControlThresholds>* rc_thresholds,
const QualityThresholds* quality_thresholds,
const BitstreamThresholds* bs_thresholds,
const VisualizationParams* visualization_params) {
// The Android HW codec needs to be run on a task queue, so we simply always
// run the test on a task queue.
@ -246,6 +247,10 @@ void VideoProcessorIntegrationTest::ProcessFramesAndMaybeVerify(
while (frame_number < num_frames) {
UpdateRateControlMetrics(frame_number);
if (bs_thresholds) {
VerifyBitstream(frame_number, *bs_thresholds);
}
++frame_number;
if (frame_number ==
@ -336,6 +341,13 @@ void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
case kVideoCodecH264:
// TODO(brandtr): Generalize so that we support multiple profiles here.
codec = cricket::VideoCodec(cricket::kH264CodecName);
if (config_.packetization_mode == H264PacketizationMode::NonInterleaved) {
codec.SetParam(cricket::kH264FmtpPacketizationMode, "1");
} else {
RTC_CHECK_EQ(config_.packetization_mode,
H264PacketizationMode::SingleNalUnit);
codec.SetParam(cricket::kH264FmtpPacketizationMode, "0");
}
encoder_.reset(encoder_factory->CreateVideoEncoder(codec));
decoder_.reset(
decoder_factory->CreateVideoDecoderWithParams(codec, decoder_params));
@ -562,6 +574,14 @@ void VideoProcessorIntegrationTest::PrintRateControlMetrics(
printf("\n");
}
void VideoProcessorIntegrationTest::VerifyBitstream(
int frame_number,
const BitstreamThresholds& bs_thresholds) {
RTC_CHECK_GE(frame_number, 0);
const FrameStatistic* frame_stat = stats_.GetFrame(frame_number);
EXPECT_LE(*(frame_stat->max_nalu_length), bs_thresholds.max_nalu_length);
}
// Temporal layer index corresponding to frame number, for up to 3 layers.
int VideoProcessorIntegrationTest::TemporalLayerIndexForFrame(
int frame_number) const {