xref: /aosp_15_r20/external/webrtc/video/video_stream_decoder2.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #ifndef VIDEO_VIDEO_STREAM_DECODER2_H_
12*d9f75844SAndroid Build Coastguard Worker #define VIDEO_VIDEO_STREAM_DECODER2_H_
13*d9f75844SAndroid Build Coastguard Worker 
14*d9f75844SAndroid Build Coastguard Worker #include <list>
15*d9f75844SAndroid Build Coastguard Worker #include <map>
16*d9f75844SAndroid Build Coastguard Worker #include <memory>
17*d9f75844SAndroid Build Coastguard Worker #include <vector>
18*d9f75844SAndroid Build Coastguard Worker 
19*d9f75844SAndroid Build Coastguard Worker #include "api/scoped_refptr.h"
20*d9f75844SAndroid Build Coastguard Worker #include "api/video/video_sink_interface.h"
21*d9f75844SAndroid Build Coastguard Worker #include "api/video_codecs/video_decoder.h"
22*d9f75844SAndroid Build Coastguard Worker #include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
23*d9f75844SAndroid Build Coastguard Worker #include "modules/video_coding/include/video_coding_defines.h"
24*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/platform_thread.h"
25*d9f75844SAndroid Build Coastguard Worker 
26*d9f75844SAndroid Build Coastguard Worker namespace webrtc {
27*d9f75844SAndroid Build Coastguard Worker 
28*d9f75844SAndroid Build Coastguard Worker class VideoReceiver2;
29*d9f75844SAndroid Build Coastguard Worker 
30*d9f75844SAndroid Build Coastguard Worker namespace internal {
31*d9f75844SAndroid Build Coastguard Worker 
32*d9f75844SAndroid Build Coastguard Worker class ReceiveStatisticsProxy;
33*d9f75844SAndroid Build Coastguard Worker 
34*d9f75844SAndroid Build Coastguard Worker class VideoStreamDecoder : public VCMReceiveCallback {
35*d9f75844SAndroid Build Coastguard Worker  public:
36*d9f75844SAndroid Build Coastguard Worker   VideoStreamDecoder(
37*d9f75844SAndroid Build Coastguard Worker       VideoReceiver2* video_receiver,
38*d9f75844SAndroid Build Coastguard Worker       ReceiveStatisticsProxy* receive_statistics_proxy,
39*d9f75844SAndroid Build Coastguard Worker       rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream);
40*d9f75844SAndroid Build Coastguard Worker   ~VideoStreamDecoder() override;
41*d9f75844SAndroid Build Coastguard Worker 
42*d9f75844SAndroid Build Coastguard Worker   // Implements VCMReceiveCallback.
43*d9f75844SAndroid Build Coastguard Worker   int32_t FrameToRender(VideoFrame& video_frame,
44*d9f75844SAndroid Build Coastguard Worker                         absl::optional<uint8_t> qp,
45*d9f75844SAndroid Build Coastguard Worker                         TimeDelta decode_time,
46*d9f75844SAndroid Build Coastguard Worker                         VideoContentType content_type) override;
47*d9f75844SAndroid Build Coastguard Worker   void OnDroppedFrames(uint32_t frames_dropped) override;
48*d9f75844SAndroid Build Coastguard Worker   void OnIncomingPayloadType(int payload_type) override;
49*d9f75844SAndroid Build Coastguard Worker   void OnDecoderInfoChanged(
50*d9f75844SAndroid Build Coastguard Worker       const VideoDecoder::DecoderInfo& decoder_info) override;
51*d9f75844SAndroid Build Coastguard Worker 
52*d9f75844SAndroid Build Coastguard Worker  private:
53*d9f75844SAndroid Build Coastguard Worker   VideoReceiver2* const video_receiver_;
54*d9f75844SAndroid Build Coastguard Worker   ReceiveStatisticsProxy* const receive_stats_callback_;
55*d9f75844SAndroid Build Coastguard Worker   rtc::VideoSinkInterface<VideoFrame>* const incoming_video_stream_;
56*d9f75844SAndroid Build Coastguard Worker };
57*d9f75844SAndroid Build Coastguard Worker 
58*d9f75844SAndroid Build Coastguard Worker }  // namespace internal
59*d9f75844SAndroid Build Coastguard Worker }  // namespace webrtc
60*d9f75844SAndroid Build Coastguard Worker 
61*d9f75844SAndroid Build Coastguard Worker #endif  // VIDEO_VIDEO_STREAM_DECODER2_H_
62