Added functions to control the VideoStreamDecoder playout delay.

Bug: none
Change-Id: I1ee311df9b18acaf0c7230bb2ad9cc88f996bb1a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140103
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28168}
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index dfa5467..483707b 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -167,6 +167,7 @@
     ":encoded_frame",
     ":video_frame",
     "../task_queue",
+    "../units:time_delta",
     "../video_codecs:video_codecs_api",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
diff --git a/api/video/video_stream_decoder.h b/api/video/video_stream_decoder.h
index 80c70d3..8f27fa4 100644
--- a/api/video/video_stream_decoder.h
+++ b/api/video/video_stream_decoder.h
@@ -15,6 +15,7 @@
 #include <memory>
 #include <utility>
 
+#include "api/units/time_delta.h"
 #include "api/video/encoded_frame.h"
 #include "api/video/video_frame.h"
 #include "api/video_codecs/sdp_video_format.h"
@@ -44,6 +45,9 @@
   virtual ~VideoStreamDecoderInterface() = default;
 
   virtual void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) = 0;
+
+  virtual void SetMinPlayoutDelay(TimeDelta min_delay) = 0;
+  virtual void SetMaxPlayoutDelay(TimeDelta max_delay) = 0;
 };
 
 }  // namespace webrtc
diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc
index edc87b7..cc19f7a 100644
--- a/video/video_stream_decoder_impl.cc
+++ b/video/video_stream_decoder_impl.cc
@@ -80,6 +80,14 @@
   }
 }
 
+void VideoStreamDecoderImpl::SetMinPlayoutDelay(TimeDelta min_delay) {
+  timing_.set_min_playout_delay(min_delay.ms());
+}
+
+void VideoStreamDecoderImpl::SetMaxPlayoutDelay(TimeDelta max_delay) {
+  timing_.set_max_playout_delay(max_delay.ms());
+}
+
 VideoDecoder* VideoStreamDecoderImpl::GetDecoder(int payload_type) {
   if (current_payload_type_ == payload_type) {
     RTC_DCHECK(decoder_);
diff --git a/video/video_stream_decoder_impl.h b/video/video_stream_decoder_impl.h
index b7a5e41..c439be5 100644
--- a/video/video_stream_decoder_impl.h
+++ b/video/video_stream_decoder_impl.h
@@ -39,6 +39,9 @@
 
   void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) override;
 
+  void SetMinPlayoutDelay(TimeDelta min_delay) override;
+  void SetMaxPlayoutDelay(TimeDelta max_delay) override;
+
  private:
   enum DecodeResult {
     kOk,