xref: /aosp_15_r20/external/webrtc/video/render/incoming_video_stream.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2012 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 VIDEO_RENDER_INCOMING_VIDEO_STREAM_H_
12 #define VIDEO_RENDER_INCOMING_VIDEO_STREAM_H_
13 
14 #include <stdint.h>
15 
16 #include "api/sequence_checker.h"
17 #include "api/task_queue/task_queue_factory.h"
18 #include "api/video/video_frame.h"
19 #include "api/video/video_sink_interface.h"
20 #include "rtc_base/race_checker.h"
21 #include "rtc_base/task_queue.h"
22 #include "rtc_base/thread_annotations.h"
23 #include "video/render/video_render_frames.h"
24 
25 namespace webrtc {
26 
27 class IncomingVideoStream : public rtc::VideoSinkInterface<VideoFrame> {
28  public:
29   IncomingVideoStream(TaskQueueFactory* task_queue_factory,
30                       int32_t delay_ms,
31                       rtc::VideoSinkInterface<VideoFrame>* callback);
32   ~IncomingVideoStream() override;
33 
34  private:
35   void OnFrame(const VideoFrame& video_frame) override;
36   void Dequeue();
37 
38   SequenceChecker main_thread_checker_;
39   rtc::RaceChecker decoder_race_checker_;
40 
41   VideoRenderFrames render_buffers_ RTC_GUARDED_BY(&incoming_render_queue_);
42   rtc::VideoSinkInterface<VideoFrame>* const callback_;
43   rtc::TaskQueue incoming_render_queue_;
44 };
45 
46 }  // namespace webrtc
47 
48 #endif  // VIDEO_RENDER_INCOMING_VIDEO_STREAM_H_
49