Fix parsing of vp9 skip level segmentation feature

Bug: chromium:1241297
Change-Id: I44c3e8eddcb2467aae7433f3907cff34fa807f69
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229302
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34803}
diff --git a/modules/video_coding/utility/vp9_uncompressed_header_parser.cc b/modules/video_coding/utility/vp9_uncompressed_header_parser.cc
index b8daf36..b065069 100644
--- a/modules/video_coding/utility/vp9_uncompressed_header_parser.cc
+++ b/modules/video_coding/utility/vp9_uncompressed_header_parser.cc
@@ -386,6 +386,11 @@
       for (size_t i = 0; i < kVp9MaxSegments; ++i) {
         for (size_t j = 0; j < kVp9SegLvlMax; ++j) {
           RETURN_IF_FALSE(br->IfNextBoolean([&] {  // feature_enabled
+            if (kSegmentationFeatureBits[j] == 0) {
+              // No feature bits used and no sign, just mark it and return.
+              frame_info->segmentation_features[i][j] = 1;
+              return true;
+            }
             READ_OR_RETURN(
                 br->ReadUnsigned<uint8_t>(kSegmentationFeatureBits[j]),
                 [&](uint8_t feature_value) {
diff --git a/modules/video_coding/utility/vp9_uncompressed_header_parser_unittest.cc b/modules/video_coding/utility/vp9_uncompressed_header_parser_unittest.cc
index e6cf6694..913f43e 100644
--- a/modules/video_coding/utility/vp9_uncompressed_header_parser_unittest.cc
+++ b/modules/video_coding/utility/vp9_uncompressed_header_parser_unittest.cc
@@ -84,5 +84,15 @@
               Optional(ElementsAre(255, 255, 255)));
 }
 
+TEST(Vp9UncompressedHeaderParserTest, SegmentationWithSkipLevel) {
+  const uint8_t kHeader[] = {0x90, 0x49, 0x83, 0x42, 0x80, 0x2e, 0x30, 0x00,
+                             0xb0, 0x00, 0x37, 0xff, 0x0d, 0x00, 0x02, 0x10,
+                             0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+  absl::optional<Vp9UncompressedHeader> frame_info =
+      ParseUncompressedVp9Header(kHeader);
+  ASSERT_TRUE(frame_info.has_value());
+  EXPECT_THAT(frame_info->segmentation_features[0][kVp9SegLvlSkip], Eq(1));
+}
+
 }  // namespace vp9
 }  // namespace webrtc