niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 39e9659 | 2012-03-01 18:22:48 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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_RTP_VIDEO_STREAM_RECEIVER_H_ |
| 12 | #define VIDEO_RTP_VIDEO_STREAM_RECEIVER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Benjamin Wright | 52426ed | 2019-03-01 11:01:59 -0800 | [diff] [blame] | 14 | #include <atomic> |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 15 | #include <list> |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 16 | #include <map> |
kwiberg | 27f982b | 2016-03-01 11:52:33 -0800 | [diff] [blame] | 17 | #include <memory> |
Peter Boström | 9c01725 | 2016-02-26 16:26:20 +0100 | [diff] [blame] | 18 | #include <string> |
kjellander@webrtc.org | 0fcaf99 | 2015-11-26 15:24:52 +0100 | [diff] [blame] | 19 | #include <vector> |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 20 | |
Niels Möller | 2ff1f2a | 2018-08-09 16:16:34 +0200 | [diff] [blame] | 21 | #include "absl/types/optional.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 22 | #include "api/crypto/frame_decryptor_interface.h" |
Johannes Kron | d0b69a8 | 2018-12-03 14:18:53 +0100 | [diff] [blame] | 23 | #include "api/video/color_space.h" |
Niels Möller | 2ff1f2a | 2018-08-09 16:16:34 +0200 | [diff] [blame] | 24 | #include "api/video_codecs/video_codec.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "call/rtp_packet_sink_interface.h" |
Niels Möller | df9e9ae | 2018-07-31 08:29:53 +0200 | [diff] [blame] | 26 | #include "call/syncable.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 27 | #include "call/video_receive_stream.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 28 | #include "modules/rtp_rtcp/include/receive_statistics.h" |
| 29 | #include "modules/rtp_rtcp/include/remote_ntp_time_estimator.h" |
Niels Möller | b0573bc | 2017-09-25 10:47:00 +0200 | [diff] [blame] | 30 | #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 31 | #include "modules/rtp_rtcp/include/rtp_rtcp.h" |
| 32 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
Jonas Oreland | 49ac595 | 2018-09-26 16:04:32 +0200 | [diff] [blame] | 33 | #include "modules/rtp_rtcp/source/contributing_sources.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 34 | #include "modules/video_coding/h264_sps_pps_tracker.h" |
Elad Alon | 7d6a4c0 | 2019-02-25 13:00:51 +0100 | [diff] [blame] | 35 | #include "modules/video_coding/loss_notification_controller.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 36 | #include "modules/video_coding/packet_buffer.h" |
| 37 | #include "modules/video_coding/rtp_frame_reference_finder.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 38 | #include "rtc_base/constructor_magic.h" |
| 39 | #include "rtc_base/critical_section.h" |
Bjorn Terelius | a194e58 | 2017-10-25 13:07:09 +0200 | [diff] [blame] | 40 | #include "rtc_base/numerics/sequence_number_util.h" |
Sebastian Jansson | b55015e | 2019-04-09 13:44:04 +0200 | [diff] [blame] | 41 | #include "rtc_base/synchronization/sequence_checker.h" |
Benjamin Wright | 0076529 | 2018-11-30 16:18:26 -0800 | [diff] [blame] | 42 | #include "rtc_base/thread_annotations.h" |
| 43 | #include "rtc_base/thread_checker.h" |
| 44 | #include "video/buffered_frame_decryptor.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 46 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 48 | class NackModule; |
mflodman | c0e58a3 | 2016-04-25 01:26:26 -0700 | [diff] [blame] | 49 | class PacketRouter; |
mflodman | dc7d0d2 | 2016-05-06 05:32:22 -0700 | [diff] [blame] | 50 | class ProcessThread; |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 51 | class ReceiveStatistics; |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 52 | class ReceiveStatisticsProxy; |
mflodman | c0e58a3 | 2016-04-25 01:26:26 -0700 | [diff] [blame] | 53 | class RtcpRttStats; |
nisse | 38cc1d6 | 2017-02-13 05:59:46 -0800 | [diff] [blame] | 54 | class RtpPacketReceived; |
mflodman | c0e58a3 | 2016-04-25 01:26:26 -0700 | [diff] [blame] | 55 | class Transport; |
brandtr | d55c3f6 | 2016-10-31 04:51:33 -0700 | [diff] [blame] | 56 | class UlpfecReceiver; |
Peter Boström | 0b25072 | 2016-04-22 18:23:15 +0200 | [diff] [blame] | 57 | |
Elad Alon | 7d6a4c0 | 2019-02-25 13:00:51 +0100 | [diff] [blame] | 58 | class RtpVideoStreamReceiver : public LossNotificationSender, |
| 59 | public RecoveredPacketReceiver, |
nisse | 0f15f92 | 2017-06-21 01:05:22 -0700 | [diff] [blame] | 60 | public RtpPacketSinkInterface, |
Elad Alon | b4643ad | 2019-02-22 11:19:50 +0100 | [diff] [blame] | 61 | public video_coding::OnAssembledFrameCallback, |
Benjamin Wright | 0076529 | 2018-11-30 16:18:26 -0800 | [diff] [blame] | 62 | public video_coding::OnCompleteFrameCallback, |
Benjamin Wright | 52426ed | 2019-03-01 11:01:59 -0800 | [diff] [blame] | 63 | public OnDecryptedFrameCallback, |
| 64 | public OnDecryptionStatusChangeCallback { |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 65 | public: |
nisse | b1f2ff9 | 2017-06-09 04:01:55 -0700 | [diff] [blame] | 66 | RtpVideoStreamReceiver( |
Sebastian Jansson | 8026d60 | 2019-03-04 19:39:01 +0100 | [diff] [blame] | 67 | Clock* clock, |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 68 | Transport* transport, |
| 69 | RtcpRttStats* rtt_stats, |
Niels Möller | 60f4e29 | 2019-05-20 11:06:33 +0200 | [diff] [blame^] | 70 | // The packet router is optional; if provided, the RtpRtcp module for this |
| 71 | // stream is registered as a candidate for sending REMB and transport |
| 72 | // feedback. |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 73 | PacketRouter* packet_router, |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 74 | const VideoReceiveStream::Config* config, |
nisse | ca5706d | 2017-09-11 02:32:16 -0700 | [diff] [blame] | 75 | ReceiveStatistics* rtp_receive_statistics, |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 76 | ReceiveStatisticsProxy* receive_stats_proxy, |
| 77 | ProcessThread* process_thread, |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 78 | NackSender* nack_sender, |
| 79 | KeyFrameRequestSender* keyframe_request_sender, |
Benjamin Wright | 192eeec | 2018-10-17 17:27:25 -0700 | [diff] [blame] | 80 | video_coding::OnCompleteFrameCallback* complete_frame_callback, |
| 81 | rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor); |
Mirko Bonadei | 8fdcac3 | 2018-08-28 16:30:18 +0200 | [diff] [blame] | 82 | ~RtpVideoStreamReceiver() override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 83 | |
Niels Möller | 2ff1f2a | 2018-08-09 16:16:34 +0200 | [diff] [blame] | 84 | void AddReceiveCodec(const VideoCodec& video_codec, |
philipel | 022b54e | 2016-12-20 04:15:59 -0800 | [diff] [blame] | 85 | const std::map<std::string, std::string>& codec_params); |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 86 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 87 | void StartReceive(); |
| 88 | void StopReceive(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 89 | |
Niels Möller | df9e9ae | 2018-07-31 08:29:53 +0200 | [diff] [blame] | 90 | // Produces the transport-related timestamps; current_delay_ms is left unset. |
| 91 | absl::optional<Syncable::Info> GetSyncInfo() const; |
| 92 | |
Peter Boström | d1d66ba | 2016-02-08 14:07:14 +0100 | [diff] [blame] | 93 | bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 94 | |
philipel | d4fac69 | 2017-09-04 07:03:46 -0700 | [diff] [blame] | 95 | void FrameContinuous(int64_t seq_num); |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 96 | |
philipel | d4fac69 | 2017-09-04 07:03:46 -0700 | [diff] [blame] | 97 | void FrameDecoded(int64_t seq_num); |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 98 | |
mflodman | dc7d0d2 | 2016-05-06 05:32:22 -0700 | [diff] [blame] | 99 | void SignalNetworkState(NetworkState state); |
| 100 | |
Ilya Nikolaevskiy | d397a0d | 2018-02-21 15:57:09 +0100 | [diff] [blame] | 101 | // Returns number of different frames seen in the packet buffer. |
| 102 | int GetUniqueFramesSeen() const; |
| 103 | |
nisse | 0f15f92 | 2017-06-21 01:05:22 -0700 | [diff] [blame] | 104 | // Implements RtpPacketSinkInterface. |
| 105 | void OnRtpPacket(const RtpPacketReceived& packet) override; |
nisse | 38cc1d6 | 2017-02-13 05:59:46 -0800 | [diff] [blame] | 106 | |
philipel | 2837edc | 2018-10-02 13:55:47 +0200 | [diff] [blame] | 107 | // TODO(philipel): Stop using VCMPacket in the new jitter buffer and then |
Niels Möller | 125b5d6 | 2019-03-11 16:11:07 +0100 | [diff] [blame] | 108 | // remove this function. Public only for tests. |
philipel | 2837edc | 2018-10-02 13:55:47 +0200 | [diff] [blame] | 109 | int32_t OnReceivedPayloadData( |
| 110 | const uint8_t* payload_data, |
| 111 | size_t payload_size, |
Niels Möller | 125b5d6 | 2019-03-11 16:11:07 +0100 | [diff] [blame] | 112 | const RTPHeader& rtp_header, |
| 113 | const RTPVideoHeader& video_header, |
Ying Wang | b32bb95 | 2018-10-31 10:12:27 +0100 | [diff] [blame] | 114 | const absl::optional<RtpGenericFrameDescriptor>& generic_descriptor, |
| 115 | bool is_recovered); |
philipel | 2837edc | 2018-10-02 13:55:47 +0200 | [diff] [blame] | 116 | |
nisse | 30e8931 | 2017-05-29 08:16:37 -0700 | [diff] [blame] | 117 | // Implements RecoveredPacketReceiver. |
| 118 | void OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 119 | |
Niels Möller | 4168437 | 2019-03-25 15:51:03 +0100 | [diff] [blame] | 120 | // Send an RTCP keyframe request. |
| 121 | void RequestKeyFrame(); |
mflodman | cfc8e3b | 2016-05-03 21:22:04 -0700 | [diff] [blame] | 122 | |
Elad Alon | 7d6a4c0 | 2019-02-25 13:00:51 +0100 | [diff] [blame] | 123 | // Implements LossNotificationSender. |
| 124 | void SendLossNotification(uint16_t last_decoded_seq_num, |
| 125 | uint16_t last_received_seq_num, |
| 126 | bool decodability_flag) override; |
| 127 | |
brandtr | f7c6d72 | 2016-12-08 08:25:47 -0800 | [diff] [blame] | 128 | bool IsUlpfecEnabled() const; |
mflodman | dc7d0d2 | 2016-05-06 05:32:22 -0700 | [diff] [blame] | 129 | bool IsRetransmissionsEnabled() const; |
Benjamin Wright | 52426ed | 2019-03-01 11:01:59 -0800 | [diff] [blame] | 130 | |
| 131 | // Returns true if a decryptor is attached and frames can be decrypted. |
| 132 | // Updated by OnDecryptionStatusChangeCallback. Note this refers to Frame |
| 133 | // Decryption not SRTP. |
| 134 | bool IsDecryptable() const; |
| 135 | |
mflodman | dc7d0d2 | 2016-05-06 05:32:22 -0700 | [diff] [blame] | 136 | // Don't use, still experimental. |
| 137 | void RequestPacketRetransmit(const std::vector<uint16_t>& sequence_numbers); |
| 138 | |
Elad Alon | b4643ad | 2019-02-22 11:19:50 +0100 | [diff] [blame] | 139 | // Implements OnAssembledFrameCallback. |
| 140 | void OnAssembledFrame( |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 141 | std::unique_ptr<video_coding::RtpFrameObject> frame) override; |
| 142 | |
| 143 | // Implements OnCompleteFrameCallback. |
| 144 | void OnCompleteFrame( |
philipel | e7c891f | 2018-02-22 14:35:06 +0100 | [diff] [blame] | 145 | std::unique_ptr<video_coding::EncodedFrame> frame) override; |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 146 | |
Benjamin Wright | 0076529 | 2018-11-30 16:18:26 -0800 | [diff] [blame] | 147 | // Implements OnDecryptedFrameCallback. |
| 148 | void OnDecryptedFrame( |
| 149 | std::unique_ptr<video_coding::RtpFrameObject> frame) override; |
| 150 | |
Benjamin Wright | 52426ed | 2019-03-01 11:01:59 -0800 | [diff] [blame] | 151 | // Implements OnDecryptionStatusChangeCallback. |
Benjamin Wright | 2af5dcb | 2019-04-09 20:08:41 +0000 | [diff] [blame] | 152 | void OnDecryptionStatusChange( |
| 153 | FrameDecryptorInterface::Status status) override; |
Benjamin Wright | 52426ed | 2019-03-01 11:01:59 -0800 | [diff] [blame] | 154 | |
Benjamin Wright | a556448 | 2019-04-03 10:44:18 -0700 | [diff] [blame] | 155 | // Optionally set a frame decryptor after a stream has started. This will not |
| 156 | // reset the decoder state. |
| 157 | void SetFrameDecryptor( |
| 158 | rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor); |
| 159 | |
Tommi | 81de14f | 2018-03-25 22:19:25 +0200 | [diff] [blame] | 160 | // Called by VideoReceiveStream when stats are updated. |
| 161 | void UpdateRtt(int64_t max_rtt_ms); |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 162 | |
Danil Chapovalov | b9b146c | 2018-06-15 12:28:07 +0200 | [diff] [blame] | 163 | absl::optional<int64_t> LastReceivedPacketMs() const; |
| 164 | absl::optional<int64_t> LastReceivedKeyframePacketMs() const; |
philipel | 3184f8e | 2017-05-18 08:08:53 -0700 | [diff] [blame] | 165 | |
eladalon | c0d481a | 2017-08-02 07:39:07 -0700 | [diff] [blame] | 166 | // RtpDemuxer only forwards a given RTP packet to one sink. However, some |
| 167 | // sinks, such as FlexFEC, might wish to be informed of all of the packets |
| 168 | // a given sink receives (or any set of sinks). They may do so by registering |
| 169 | // themselves as secondary sinks. |
| 170 | void AddSecondarySink(RtpPacketSinkInterface* sink); |
| 171 | void RemoveSecondarySink(const RtpPacketSinkInterface* sink); |
| 172 | |
Jonas Oreland | 49ac595 | 2018-09-26 16:04:32 +0200 | [diff] [blame] | 173 | std::vector<webrtc::RtpSource> GetSources() const; |
| 174 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 175 | private: |
Niels Möller | 2ff1f2a | 2018-08-09 16:16:34 +0200 | [diff] [blame] | 176 | // Entry point doing non-stats work for a received packet. Called |
| 177 | // for the same packet both before and after RED decapsulation. |
| 178 | void ReceivePacket(const RtpPacketReceived& packet); |
| 179 | // Parses and handles RED headers. |
stefan@webrtc.org | 7bb8f02 | 2013-09-06 13:40:11 +0000 | [diff] [blame] | 180 | // This function assumes that it's being called from only one thread. |
Niels Möller | 1f3206c | 2018-09-14 08:26:32 +0200 | [diff] [blame] | 181 | void ParseAndHandleEncapsulatingHeader(const RtpPacketReceived& packet); |
Niels Möller | bc01047 | 2018-03-23 13:22:29 +0100 | [diff] [blame] | 182 | void NotifyReceiverOfEmptyPacket(uint16_t seq_num); |
asapersson@webrtc.org | 0800db7 | 2015-01-15 07:40:20 +0000 | [diff] [blame] | 183 | void UpdateHistograms(); |
brandtr | e6f98c7 | 2016-11-11 03:28:30 -0800 | [diff] [blame] | 184 | bool IsRedEnabled() const; |
philipel | 022b54e | 2016-12-20 04:15:59 -0800 | [diff] [blame] | 185 | void InsertSpsPpsIntoTracker(uint8_t payload_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 186 | |
Peter Boström | 4fa7eca | 2016-03-02 15:05:53 +0100 | [diff] [blame] | 187 | Clock* const clock_; |
Tommi | 733b547 | 2016-06-10 17:58:01 +0200 | [diff] [blame] | 188 | // Ownership of this object lies with VideoReceiveStream, which owns |this|. |
| 189 | const VideoReceiveStream::Config& config_; |
mflodman | c0e58a3 | 2016-04-25 01:26:26 -0700 | [diff] [blame] | 190 | PacketRouter* const packet_router_; |
mflodman | dc7d0d2 | 2016-05-06 05:32:22 -0700 | [diff] [blame] | 191 | ProcessThread* const process_thread_; |
Peter Boström | 4fa7eca | 2016-03-02 15:05:53 +0100 | [diff] [blame] | 192 | |
| 193 | RemoteNtpTimeEstimator ntp_estimator_; |
Peter Boström | 4fa7eca | 2016-03-02 15:05:53 +0100 | [diff] [blame] | 194 | |
Niels Möller | b0573bc | 2017-09-25 10:47:00 +0200 | [diff] [blame] | 195 | RtpHeaderExtensionMap rtp_header_extensions_; |
nisse | ca5706d | 2017-09-11 02:32:16 -0700 | [diff] [blame] | 196 | ReceiveStatistics* const rtp_receive_statistics_; |
brandtr | d55c3f6 | 2016-10-31 04:51:33 -0700 | [diff] [blame] | 197 | std::unique_ptr<UlpfecReceiver> ulpfec_receiver_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 198 | |
Sebastian Jansson | b55015e | 2019-04-09 13:44:04 +0200 | [diff] [blame] | 199 | SequenceChecker worker_task_checker_; |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 200 | bool receiving_ RTC_GUARDED_BY(worker_task_checker_); |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 201 | int64_t last_packet_log_ms_ RTC_GUARDED_BY(worker_task_checker_); |
mflodman | c0e58a3 | 2016-04-25 01:26:26 -0700 | [diff] [blame] | 202 | |
| 203 | const std::unique_ptr<RtpRtcp> rtp_rtcp_; |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 204 | |
| 205 | // Members for the new jitter buffer experiment. |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 206 | video_coding::OnCompleteFrameCallback* complete_frame_callback_; |
Elad Alon | 7d6a4c0 | 2019-02-25 13:00:51 +0100 | [diff] [blame] | 207 | KeyFrameRequestSender* const keyframe_request_sender_; |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 208 | std::unique_ptr<NackModule> nack_module_; |
Elad Alon | 7d6a4c0 | 2019-02-25 13:00:51 +0100 | [diff] [blame] | 209 | std::unique_ptr<LossNotificationController> loss_notification_controller_; |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 210 | rtc::scoped_refptr<video_coding::PacketBuffer> packet_buffer_; |
| 211 | std::unique_ptr<video_coding::RtpFrameReferenceFinder> reference_finder_; |
| 212 | rtc::CriticalSection last_seq_num_cs_; |
philipel | d4fac69 | 2017-09-04 07:03:46 -0700 | [diff] [blame] | 213 | std::map<int64_t, uint16_t> last_seq_num_for_pic_id_ |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 214 | RTC_GUARDED_BY(last_seq_num_cs_); |
philipel | fd5a20f | 2016-11-15 00:57:57 -0800 | [diff] [blame] | 215 | video_coding::H264SpsPpsTracker tracker_; |
Niels Möller | 2ff1f2a | 2018-08-09 16:16:34 +0200 | [diff] [blame] | 216 | |
Niels Möller | 2ff1f2a | 2018-08-09 16:16:34 +0200 | [diff] [blame] | 217 | std::map<uint8_t, VideoCodecType> pt_codec_type_; |
philipel | 022b54e | 2016-12-20 04:15:59 -0800 | [diff] [blame] | 218 | // TODO(johan): Remove pt_codec_params_ once |
| 219 | // https://bugs.chromium.org/p/webrtc/issues/detail?id=6883 is resolved. |
| 220 | // Maps a payload type to a map of out-of-band supplied codec parameters. |
| 221 | std::map<uint8_t, std::map<std::string, std::string>> pt_codec_params_; |
| 222 | int16_t last_payload_type_ = -1; |
philipel | 2c53b13 | 2017-05-16 08:06:30 -0700 | [diff] [blame] | 223 | |
| 224 | bool has_received_frame_; |
eladalon | c0d481a | 2017-08-02 07:39:07 -0700 | [diff] [blame] | 225 | |
eladalon | 8b07305 | 2017-08-25 00:49:08 -0700 | [diff] [blame] | 226 | std::vector<RtpPacketSinkInterface*> secondary_sinks_ |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 227 | RTC_GUARDED_BY(worker_task_checker_); |
Jonas Oreland | 49ac595 | 2018-09-26 16:04:32 +0200 | [diff] [blame] | 228 | |
| 229 | // Info for GetSources and GetSyncInfo is updated on network or worker thread, |
| 230 | // queried on the worker thread. |
| 231 | rtc::CriticalSection rtp_sources_lock_; |
| 232 | ContributingSources contributing_sources_ RTC_GUARDED_BY(&rtp_sources_lock_); |
| 233 | absl::optional<uint32_t> last_received_rtp_timestamp_ |
| 234 | RTC_GUARDED_BY(rtp_sources_lock_); |
| 235 | absl::optional<int64_t> last_received_rtp_system_time_ms_ |
| 236 | RTC_GUARDED_BY(rtp_sources_lock_); |
Benjamin Wright | 192eeec | 2018-10-17 17:27:25 -0700 | [diff] [blame] | 237 | |
Benjamin Wright | 0076529 | 2018-11-30 16:18:26 -0800 | [diff] [blame] | 238 | // Used to validate the buffered frame decryptor is always run on the correct |
| 239 | // thread. |
| 240 | rtc::ThreadChecker network_tc_; |
| 241 | // Handles incoming encrypted frames and forwards them to the |
| 242 | // rtp_reference_finder if they are decryptable. |
| 243 | std::unique_ptr<BufferedFrameDecryptor> buffered_frame_decryptor_ |
| 244 | RTC_PT_GUARDED_BY(network_tc_); |
Benjamin Wright | 52426ed | 2019-03-01 11:01:59 -0800 | [diff] [blame] | 245 | std::atomic<bool> frames_decryptable_; |
Johannes Kron | d0b69a8 | 2018-12-03 14:18:53 +0100 | [diff] [blame] | 246 | absl::optional<ColorSpace> last_color_space_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 247 | }; |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 248 | |
kjellander@webrtc.org | 0fcaf99 | 2015-11-26 15:24:52 +0100 | [diff] [blame] | 249 | } // namespace webrtc |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 250 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 251 | #endif // VIDEO_RTP_VIDEO_STREAM_RECEIVER_H_ |