xref: /aosp_15_r20/external/webrtc/api/video/video_sink_interface.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef API_VIDEO_VIDEO_SINK_INTERFACE_H_
12 #define API_VIDEO_VIDEO_SINK_INTERFACE_H_
13 
14 #include "absl/types/optional.h"
15 #include "api/video_track_source_constraints.h"
16 #include "rtc_base/checks.h"
17 
18 namespace rtc {
19 
20 template <typename VideoFrameT>
21 class VideoSinkInterface {
22  public:
23   virtual ~VideoSinkInterface() = default;
24 
25   virtual void OnFrame(const VideoFrameT& frame) = 0;
26 
27   // Should be called by the source when it discards the frame due to rate
28   // limiting.
OnDiscardedFrame()29   virtual void OnDiscardedFrame() {}
30 
31   // Called on the network thread when video constraints change.
32   // TODO(crbug/1255737): make pure virtual once downstream project adapts.
OnConstraintsChanged(const webrtc::VideoTrackSourceConstraints & constraints)33   virtual void OnConstraintsChanged(
34       const webrtc::VideoTrackSourceConstraints& constraints) {}
35 };
36 
37 }  // namespace rtc
38 
39 #endif  // API_VIDEO_VIDEO_SINK_INTERFACE_H_
40