Skip to content

Commit

Permalink
Add fuzzer to validate libvpx vp9 encoder wrapper
Browse files Browse the repository at this point in the history
Fix simulcast svc controller to reuse dropped frame configuration,
same as full svc and k-svc controllers do.
This fuzzer reminded the issue was still there.

Bug: webrtc:11999
Change-Id: I74156bd743124723562e99deb48de5b5018a81d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212281
Reviewed-by: Erik Språng <[email protected]>
Commit-Queue: Danil Chapovalov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#33568}
  • Loading branch information
DanilChapovalov authored and Commit Bot committed Mar 25, 2021
1 parent 4f88a9d commit c184047
Show file tree
Hide file tree
Showing 3 changed files with 511 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/video_coding/svc/scalability_structure_simulcast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ScalabilityStructureSimulcast::NextFrameConfig(bool restart) {
}
configs.emplace_back();
ScalableVideoController::LayerFrameConfig& config = configs.back();
config.S(sid).T(0);
config.Id(current_pattern).S(sid).T(0);

if (can_reference_t0_frame_for_spatial_id_[sid]) {
config.ReferenceAndUpdate(BufferIndex(sid, /*tid=*/0));
Expand All @@ -155,7 +155,10 @@ ScalabilityStructureSimulcast::NextFrameConfig(bool restart) {
}
configs.emplace_back();
ScalableVideoController::LayerFrameConfig& config = configs.back();
config.S(sid).T(1).Reference(BufferIndex(sid, /*tid=*/0));
config.Id(current_pattern)
.S(sid)
.T(1)
.Reference(BufferIndex(sid, /*tid=*/0));
// Save frame only if there is a higher temporal layer that may need it.
if (num_temporal_layers_ > 2) {
config.Update(BufferIndex(sid, /*tid=*/1));
Expand All @@ -171,7 +174,7 @@ ScalabilityStructureSimulcast::NextFrameConfig(bool restart) {
}
configs.emplace_back();
ScalableVideoController::LayerFrameConfig& config = configs.back();
config.S(sid).T(2);
config.Id(current_pattern).S(sid).T(2);
if (can_reference_t1_frame_for_spatial_id_[sid]) {
config.Reference(BufferIndex(sid, /*tid=*/1));
} else {
Expand All @@ -184,12 +187,12 @@ ScalabilityStructureSimulcast::NextFrameConfig(bool restart) {
break;
}

last_pattern_ = current_pattern;
return configs;
}

GenericFrameInfo ScalabilityStructureSimulcast::OnEncodeDone(
const LayerFrameConfig& config) {
last_pattern_ = static_cast<FramePattern>(config.Id());
if (config.TemporalId() == 1) {
can_reference_t1_frame_for_spatial_id_.set(config.SpatialId());
}
Expand Down
24 changes: 24 additions & 0 deletions test/fuzzers/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,30 @@ webrtc_fuzzer_test("vp8_replay_fuzzer") {
seed_corpus = "corpora/rtpdump-corpus/vp8"
}

if (rtc_build_libvpx) {
webrtc_fuzzer_test("vp9_encoder_references_fuzzer") {
sources = [ "vp9_encoder_references_fuzzer.cc" ]
deps = [
"..:test_support",
"../../api:array_view",
"../../api/transport:webrtc_key_value_config",
"../../api/video:video_frame",
"../../api/video_codecs:video_codecs_api",
"../../modules/video_coding:frame_dependencies_calculator",
"../../modules/video_coding:mock_libvpx_interface",
"../../modules/video_coding:webrtc_vp9",
"../../rtc_base:safe_compare",
rtc_libvpx_dir,
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/container:inlined_vector",
]
defines = [ "RTC_ENABLE_VP9" ]
}
}

webrtc_fuzzer_test("vp9_replay_fuzzer") {
sources = [ "vp9_replay_fuzzer.cc" ]
deps = [
Expand Down
Loading

0 comments on commit c184047

Please sign in to comment.