xref: /aosp_15_r20/external/webrtc/sdk/objc/native/src/objc_video_track_source.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2017 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 SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_
12 #define SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_
13 
14 #import "base/RTCVideoCapturer.h"
15 
16 #include "base/RTCMacros.h"
17 #include "media/base/adapted_video_track_source.h"
18 #include "rtc_base/timestamp_aligner.h"
19 
20 RTC_FWD_DECL_OBJC_CLASS(RTC_OBJC_TYPE(RTCVideoFrame));
21 
22 @interface RTCObjCVideoSourceAdapter : NSObject <RTC_OBJC_TYPE (RTCVideoCapturerDelegate)>
23 @end
24 
25 namespace webrtc {
26 
27 class ObjCVideoTrackSource : public rtc::AdaptedVideoTrackSource {
28  public:
29   ObjCVideoTrackSource();
30   explicit ObjCVideoTrackSource(bool is_screencast);
31   explicit ObjCVideoTrackSource(RTCObjCVideoSourceAdapter* adapter);
32 
33   bool is_screencast() const override;
34 
35   // Indicates that the encoder should denoise video before encoding it.
36   // If it is not set, the default configuration is used which is different
37   // depending on video codec.
38   absl::optional<bool> needs_denoising() const override;
39 
40   SourceState state() const override;
41 
42   bool remote() const override;
43 
44   void OnCapturedFrame(RTC_OBJC_TYPE(RTCVideoFrame) * frame);
45 
46   // Called by RTCVideoSource.
47   void OnOutputFormatRequest(int width, int height, int fps);
48 
49  private:
50   rtc::VideoBroadcaster broadcaster_;
51   rtc::TimestampAligner timestamp_aligner_;
52 
53   RTCObjCVideoSourceAdapter* adapter_;
54   bool is_screencast_;
55 };
56 
57 }  // namespace webrtc
58 
59 #endif  // SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_
60