| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_VIDEO_VIE_RECEIVER_H_ | 11 #ifndef WEBRTC_VIDEO_VIE_RECEIVER_H_ |
| 12 #define WEBRTC_VIDEO_VIE_RECEIVER_H_ | 12 #define WEBRTC_VIDEO_VIE_RECEIVER_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
| 19 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
| 20 #include "webrtc/engine_configurations.h" | 20 #include "webrtc/engine_configurations.h" |
| 21 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 21 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" |
| 23 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 23 #include "webrtc/typedefs.h" | 25 #include "webrtc/typedefs.h" |
| 24 | 26 |
| 25 namespace webrtc { | 27 namespace webrtc { |
| 26 | 28 |
| 27 class FecReceiver; | 29 class FecReceiver; |
| 28 class RemoteNtpTimeEstimator; | 30 class RemoteNtpTimeEstimator; |
| 29 class ReceiveStatistics; | 31 class ReceiveStatistics; |
| 30 class RemoteBitrateEstimator; | 32 class RemoteBitrateEstimator; |
| 31 class RtpHeaderParser; | 33 class RtpHeaderParser; |
| 32 class RTPPayloadRegistry; | 34 class RTPPayloadRegistry; |
| 33 class RtpReceiver; | 35 class RtpReceiver; |
| 34 class RtpRtcp; | 36 class RtpRtcp; |
| 35 class VideoCodingModule; | 37 class VideoCodingModule; |
| 36 | 38 |
| 37 class ViEReceiver : public RtpData { | 39 class ViEReceiver : public RtpData { |
| 38 public: | 40 public: |
| 39 ViEReceiver(VideoCodingModule* module_vcm, | 41 ViEReceiver(VideoCodingModule* module_vcm, |
| 40 RemoteBitrateEstimator* remote_bitrate_estimator, | 42 RemoteBitrateEstimator* remote_bitrate_estimator, |
| 41 RtpFeedback* rtp_feedback); | 43 RtpFeedback* rtp_feedback); |
| 42 ~ViEReceiver(); | 44 ~ViEReceiver(); |
| 43 | 45 |
| 44 bool SetReceiveCodec(const VideoCodec& video_codec); | 46 bool SetReceiveCodec(const VideoCodec& video_codec); |
| 45 bool RegisterPayload(const VideoCodec& video_codec); | |
| 46 | 47 |
| 47 void SetNackStatus(bool enable, int max_nack_reordering_threshold); | 48 void SetNackStatus(bool enable, int max_nack_reordering_threshold); |
| 48 void SetRtxPayloadType(int payload_type, int associated_payload_type); | 49 void SetRtxPayloadType(int payload_type, int associated_payload_type); |
| 49 // If set to true, the RTX payload type mapping supplied in | 50 // If set to true, the RTX payload type mapping supplied in |
| 50 // |SetRtxPayloadType| will be used when restoring RTX packets. Without it, | 51 // |SetRtxPayloadType| will be used when restoring RTX packets. Without it, |
| 51 // RTX packets will always be restored to the last non-RTX packet payload type | 52 // RTX packets will always be restored to the last non-RTX packet payload type |
| 52 // received. | 53 // received. |
| 53 void SetUseRtxPayloadMappingOnRestore(bool val); | 54 void SetUseRtxPayloadMappingOnRestore(bool val); |
| 54 void SetRtxSsrc(uint32_t ssrc); | 55 void SetRtxSsrc(uint32_t ssrc); |
| 55 bool GetRtxSsrc(uint32_t* ssrc) const; | 56 bool GetRtxSsrc(uint32_t* ssrc) const; |
| 56 | 57 |
| 57 bool IsFecEnabled() const; | 58 bool IsFecEnabled() const; |
| 58 | 59 |
| 59 uint32_t GetRemoteSsrc() const; | 60 uint32_t GetRemoteSsrc() const; |
| 60 int GetCsrcs(uint32_t* csrcs) const; | 61 int GetCsrcs(uint32_t* csrcs) const; |
| 61 | 62 |
| 62 void SetRtpRtcpModule(RtpRtcp* module); | 63 void Init(const std::vector<RtpRtcp*>& modules); |
| 63 | 64 |
| 64 RtpReceiver* GetRtpReceiver() const; | 65 RtpReceiver* GetRtpReceiver() const; |
| 65 | 66 |
| 66 void RegisterRtpRtcpModules(const std::vector<RtpRtcp*>& rtp_modules); | |
| 67 | |
| 68 void EnableReceiveRtpHeaderExtension(const std::string& extension, int id); | 67 void EnableReceiveRtpHeaderExtension(const std::string& extension, int id); |
| 69 | 68 |
| 70 void StartReceive(); | 69 void StartReceive(); |
| 71 void StopReceive(); | 70 void StopReceive(); |
| 72 | 71 |
| 73 bool DeliverRtp(const uint8_t* rtp_packet, | 72 bool DeliverRtp(const uint8_t* rtp_packet, |
| 74 size_t rtp_packet_length, | 73 size_t rtp_packet_length, |
| 75 const PacketTime& packet_time); | 74 const PacketTime& packet_time); |
| 76 bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length); | 75 bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length); |
| 77 | 76 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 // Parses and handles for instance RTX and RED headers. | 90 // Parses and handles for instance RTX and RED headers. |
| 92 // This function assumes that it's being called from only one thread. | 91 // This function assumes that it's being called from only one thread. |
| 93 bool ParseAndHandleEncapsulatingHeader(const uint8_t* packet, | 92 bool ParseAndHandleEncapsulatingHeader(const uint8_t* packet, |
| 94 size_t packet_length, | 93 size_t packet_length, |
| 95 const RTPHeader& header); | 94 const RTPHeader& header); |
| 96 void NotifyReceiverOfFecPacket(const RTPHeader& header); | 95 void NotifyReceiverOfFecPacket(const RTPHeader& header); |
| 97 bool IsPacketInOrder(const RTPHeader& header) const; | 96 bool IsPacketInOrder(const RTPHeader& header) const; |
| 98 bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const; | 97 bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const; |
| 99 void UpdateHistograms(); | 98 void UpdateHistograms(); |
| 100 | 99 |
| 101 rtc::CriticalSection receive_cs_; | 100 Clock* const clock_; |
| 102 Clock* clock_; | 101 VideoCodingModule* const vcm_; |
| 103 rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_; | 102 RemoteBitrateEstimator* const remote_bitrate_estimator_; |
| 104 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; | 103 |
| 105 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; | 104 // TODO(pbos): Make const and set on construction. |
| 105 std::vector<RtpRtcp*> rtp_rtcp_; |
| 106 |
| 107 RemoteNtpTimeEstimator ntp_estimator_; |
| 108 RTPPayloadRegistry rtp_payload_registry_; |
| 109 |
| 110 const rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_; |
| 111 const rtc::scoped_ptr<RtpReceiver> rtp_receiver_; |
| 106 const rtc::scoped_ptr<ReceiveStatistics> rtp_receive_statistics_; | 112 const rtc::scoped_ptr<ReceiveStatistics> rtp_receive_statistics_; |
| 107 rtc::scoped_ptr<FecReceiver> fec_receiver_; | 113 rtc::scoped_ptr<FecReceiver> fec_receiver_; |
| 108 RtpRtcp* rtp_rtcp_; | |
| 109 std::vector<RtpRtcp*> rtp_rtcp_simulcast_; | |
| 110 VideoCodingModule* vcm_; | |
| 111 RemoteBitrateEstimator* remote_bitrate_estimator_; | |
| 112 | 114 |
| 113 rtc::scoped_ptr<RemoteNtpTimeEstimator> ntp_estimator_; | 115 rtc::CriticalSection receive_cs_; |
| 114 | 116 bool receiving_ GUARDED_BY(receive_cs_); |
| 115 bool receiving_; | 117 uint8_t restored_packet_[IP_PACKET_SIZE] GUARDED_BY(receive_cs_); |
| 116 uint8_t restored_packet_[IP_PACKET_SIZE]; | 118 bool restored_packet_in_use_ GUARDED_BY(receive_cs_); |
| 117 bool restored_packet_in_use_; | 119 int64_t last_packet_log_ms_ GUARDED_BY(receive_cs_); |
| 118 int64_t last_packet_log_ms_; | |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 } // namespace webrtc | 122 } // namespace webrtc |
| 122 | 123 |
| 123 #endif // WEBRTC_VIDEO_VIE_RECEIVER_H_ | 124 #endif // WEBRTC_VIDEO_VIE_RECEIVER_H_ |
| OLD | NEW |