mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef VIDEO_VIDEO_STREAM_DECODER_H_ |
| 12 | #define VIDEO_VIDEO_STREAM_DECODER_H_ |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 13 | |
| 14 | #include <list> |
| 15 | #include <map> |
| 16 | #include <memory> |
| 17 | #include <vector> |
| 18 | |
Mirko Bonadei | d970807 | 2019-01-25 20:26:48 +0100 | [diff] [blame] | 19 | #include "api/scoped_refptr.h" |
Niels Möller | c6ce9c5 | 2018-05-11 11:15:30 +0200 | [diff] [blame] | 20 | #include "api/video/video_sink_interface.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
| 22 | #include "modules/video_coding/include/video_coding_defines.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 23 | #include "rtc_base/critical_section.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "rtc_base/platform_thread.h" |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 25 | |
| 26 | namespace webrtc { |
| 27 | |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 28 | class ReceiveStatisticsProxy; |
Niels Möller | ee3d995 | 2019-09-09 12:51:55 +0200 | [diff] [blame] | 29 | class VideoReceiver2; |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 30 | |
Niels Möller | 4168437 | 2019-03-25 15:51:03 +0100 | [diff] [blame] | 31 | class VideoStreamDecoder : public VCMReceiveCallback { |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 32 | public: |
nisse | 76bc8e8 | 2017-02-07 09:37:41 -0800 | [diff] [blame] | 33 | VideoStreamDecoder( |
Niels Möller | ee3d995 | 2019-09-09 12:51:55 +0200 | [diff] [blame] | 34 | VideoReceiver2* video_receiver, |
nisse | 76bc8e8 | 2017-02-07 09:37:41 -0800 | [diff] [blame] | 35 | ReceiveStatisticsProxy* receive_statistics_proxy, |
| 36 | rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream); |
Mirko Bonadei | 8fdcac3 | 2018-08-28 16:30:18 +0200 | [diff] [blame] | 37 | ~VideoStreamDecoder() override; |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 38 | |
| 39 | // Implements VCMReceiveCallback. |
sakal | cc452e1 | 2017-02-09 04:53:45 -0800 | [diff] [blame] | 40 | int32_t FrameToRender(VideoFrame& video_frame, |
Danil Chapovalov | b9b146c | 2018-06-15 12:28:07 +0200 | [diff] [blame] | 41 | absl::optional<uint8_t> qp, |
Johannes Kron | bfd343b | 2019-07-01 10:07:50 +0200 | [diff] [blame] | 42 | int32_t decode_time_ms, |
ilnik | 00d802b | 2017-04-11 10:34:31 -0700 | [diff] [blame] | 43 | VideoContentType content_type) override; |
Johannes Kron | 0c141c5 | 2019-08-26 15:04:43 +0200 | [diff] [blame] | 44 | void OnDroppedFrames(uint32_t frames_dropped) override; |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 45 | void OnIncomingPayloadType(int payload_type) override; |
| 46 | void OnDecoderImplementationName(const char* implementation_name) override; |
| 47 | |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 48 | void RegisterReceiveStatisticsProxy( |
| 49 | ReceiveStatisticsProxy* receive_statistics_proxy); |
| 50 | |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 51 | private: |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 52 | // Used for all registered callbacks except rendering. |
| 53 | rtc::CriticalSection crit_; |
| 54 | |
Niels Möller | ee3d995 | 2019-09-09 12:51:55 +0200 | [diff] [blame] | 55 | VideoReceiver2* const video_receiver_; |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 56 | |
| 57 | ReceiveStatisticsProxy* const receive_stats_callback_; |
tommi | 2e82f38 | 2016-06-21 00:26:43 -0700 | [diff] [blame] | 58 | rtc::VideoSinkInterface<VideoFrame>* const incoming_video_stream_; |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace webrtc |
| 62 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 63 | #endif // VIDEO_VIDEO_STREAM_DECODER_H_ |