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_VIDEO_STREAM_DECODER_H_ 12 #define VIDEO_VIDEO_STREAM_DECODER_H_ 13 14 #include <list> 15 #include <map> 16 #include <memory> 17 #include <vector> 18 19 #include "api/scoped_refptr.h" 20 #include "api/video/video_sink_interface.h" 21 #include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" 22 #include "modules/video_coding/include/video_coding_defines.h" 23 #include "rtc_base/platform_thread.h" 24 #include "rtc_base/synchronization/mutex.h" 25 26 namespace webrtc { 27 28 class ReceiveStatisticsProxy; 29 class VideoReceiver2; 30 31 class VideoStreamDecoder : public VCMReceiveCallback { 32 public: 33 VideoStreamDecoder( 34 VideoReceiver2* video_receiver, 35 ReceiveStatisticsProxy* receive_statistics_proxy, 36 rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream); 37 ~VideoStreamDecoder() override; 38 39 // Implements VCMReceiveCallback. 40 int32_t FrameToRender(VideoFrame& video_frame, 41 absl::optional<uint8_t> qp, 42 int32_t decode_time_ms, 43 VideoContentType content_type) override; 44 void OnDroppedFrames(uint32_t frames_dropped) override; 45 void OnIncomingPayloadType(int payload_type) override; 46 void OnDecoderImplementationName(const char* implementation_name) override; 47 48 void RegisterReceiveStatisticsProxy( 49 ReceiveStatisticsProxy* receive_statistics_proxy); 50 51 private: 52 // Used for all registered callbacks except rendering. 53 Mutex mutex_; 54 55 VideoReceiver2* const video_receiver_; 56 57 ReceiveStatisticsProxy* const receive_stats_callback_; 58 rtc::VideoSinkInterface<VideoFrame>* const incoming_video_stream_; 59 }; 60 61 } // namespace webrtc 62 63 #endif // VIDEO_VIDEO_STREAM_DECODER_H_ 64