Remove RtpVideoHeader::discardable flag.

Calculate it when used instead

Bug: webrtc:11358
Change-Id: Ib79a4ce5e48a1a5244925471c005f96c5ec5dfd0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173702
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31109}
diff --git a/call/rtp_payload_params.cc b/call/rtp_payload_params.cc
index bce3c13..279eb58 100644
--- a/call/rtp_payload_params.cc
+++ b/call/rtp_payload_params.cc
@@ -14,7 +14,6 @@
 
 #include <algorithm>
 
-#include "absl/algorithm/container.h"
 #include "absl/container/inlined_vector.h"
 #include "absl/strings/match.h"
 #include "absl/types/variant.h"
@@ -265,9 +264,6 @@
   generic.spatial_index = frame_info.spatial_id;
   generic.temporal_index = frame_info.temporal_id;
   generic.decode_target_indications = frame_info.decode_target_indications;
-  generic.discardable =
-      absl::c_linear_search(frame_info.decode_target_indications,
-                            DecodeTargetIndication::kDiscardable);
   return generic;
 }
 
diff --git a/call/rtp_payload_params_unittest.cc b/call/rtp_payload_params_unittest.cc
index 1d6a70c1..1045504 100644
--- a/call/rtp_payload_params_unittest.cc
+++ b/call/rtp_payload_params_unittest.cc
@@ -398,7 +398,6 @@
   EXPECT_THAT(key_header.generic->dependencies, IsEmpty());
   EXPECT_THAT(key_header.generic->decode_target_indications,
               ElementsAre(DecodeTargetIndication::kSwitch));
-  EXPECT_FALSE(key_header.generic->discardable);
 
   encoded_image._frameType = VideoFrameType::kVideoFrameDelta;
   codec_info.generic_frame_info =
@@ -415,7 +414,6 @@
   EXPECT_THAT(delta_header.generic->dependencies, ElementsAre(1));
   EXPECT_THAT(delta_header.generic->decode_target_indications,
               ElementsAre(DecodeTargetIndication::kDiscardable));
-  EXPECT_TRUE(delta_header.generic->discardable);
 }
 
 class RtpPayloadParamsVp8ToGenericTest : public ::testing::Test {
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index 9ac4cde..4441c76 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -19,6 +19,7 @@
 #include <string>
 #include <utility>
 
+#include "absl/algorithm/container.h"
 #include "absl/memory/memory.h"
 #include "absl/strings/match.h"
 #include "api/crypto/frame_encryptor_interface.h"
@@ -652,8 +653,11 @@
 
   if (video_header.frame_type == VideoFrameType::kVideoFrameKey ||
       (IsBaseLayer(video_header) &&
-       !(video_header.generic.has_value() ? video_header.generic->discardable
-                                          : false))) {
+       !(video_header.generic.has_value()
+             ? absl::c_linear_search(
+                   video_header.generic->decode_target_indications,
+                   DecodeTargetIndication::kDiscardable)
+             : false))) {
     // This frame has guaranteed delivery, no need to populate playout
     // delay extensions until it changes again.
     playout_delay_pending_ = false;
diff --git a/modules/rtp_rtcp/source/rtp_video_header.h b/modules/rtp_rtcp/source/rtp_video_header.h
index 714d1eb..7071463 100644
--- a/modules/rtp_rtcp/source/rtp_video_header.h
+++ b/modules/rtp_rtcp/source/rtp_video_header.h
@@ -53,7 +53,6 @@
     int temporal_index = 0;
     absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
     absl::InlinedVector<int64_t, 5> dependencies;
-    bool discardable = false;
   };
 
   RTPVideoHeader();
diff --git a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
index 5e7e8b9..a9f33fe 100644
--- a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
+++ b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
@@ -78,7 +78,6 @@
   result->frame_id = reader->GetNum<int32_t>();
   result->spatial_index = (flags & 0b0111'0000) >> 4;
   result->temporal_index = (flags & 0b0000'1110) >> 1;
-  result->discardable = (flags & 0b0000'0001);
 
   // Larger than supported by the RtpFrameReferenceFinder.
   int num_diffs = (reader->GetNum<uint8_t>() % 16);
diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc
index 2737103..3f5186b 100644
--- a/video/rtp_video_stream_receiver.cc
+++ b/video/rtp_video_stream_receiver.cc
@@ -380,9 +380,6 @@
     }
     generic_descriptor_info.decode_target_indications =
         dependency_descriptor.frame_dependencies.decode_target_indications;
-    generic_descriptor_info.discardable =
-        absl::c_linear_search(generic_descriptor_info.decode_target_indications,
-                              DecodeTargetIndication::kDiscardable);
     if (dependency_descriptor.resolution) {
       video_header->width = dependency_descriptor.resolution->Width();
       video_header->height = dependency_descriptor.resolution->Height();
@@ -774,7 +771,9 @@
 
   if (loss_notification_controller_ && descriptor) {
     loss_notification_controller_->OnAssembledFrame(
-        frame->first_seq_num(), descriptor->frame_id, descriptor->discardable,
+        frame->first_seq_num(), descriptor->frame_id,
+        absl::c_linear_search(descriptor->decode_target_indications,
+                              DecodeTargetIndication::kDiscardable),
         descriptor->dependencies);
   }