andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [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 | |
| 11 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_ |
| 13 | |
| 14 | #include <list> |
| 15 | |
pwestin@webrtc.org | 065b64d | 2013-04-02 20:37:14 +0000 | [diff] [blame] | 16 | #include "webrtc/engine_configurations.h" |
| 17 | #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| 18 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
| 19 | #include "webrtc/typedefs.h" |
| 20 | #include "webrtc/video_engine/vie_defines.h" |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | class CriticalSectionWrapper; |
| 25 | class Encryption; |
| 26 | class RemoteBitrateEstimator; |
| 27 | class RtpDump; |
stefan@webrtc.org | 6696fba | 2013-05-29 12:12:51 +0000 | [diff] [blame] | 28 | class RtpHeaderParser; |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 29 | class RtpRtcp; |
| 30 | class VideoCodingModule; |
| 31 | |
pwestin@webrtc.org | 065b64d | 2013-04-02 20:37:14 +0000 | [diff] [blame] | 32 | class ViEReceiver : public RtpData { |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 33 | public: |
| 34 | ViEReceiver(const int32_t channel_id, VideoCodingModule* module_vcm, |
| 35 | RemoteBitrateEstimator* remote_bitrate_estimator); |
| 36 | ~ViEReceiver(); |
| 37 | |
| 38 | int RegisterExternalDecryption(Encryption* decryption); |
| 39 | int DeregisterExternalDecryption(); |
| 40 | |
| 41 | void SetRtpRtcpModule(RtpRtcp* module); |
| 42 | |
| 43 | void RegisterSimulcastRtpRtcpModules(const std::list<RtpRtcp*>& rtp_modules); |
| 44 | |
stefan@webrtc.org | 4e5f983 | 2013-05-29 13:28:21 +0000 | [diff] [blame] | 45 | bool SetReceiveTimestampOffsetStatus(bool enable, int id); |
| 46 | bool SetReceiveAbsoluteSendTimeStatus(bool enable, int id); |
stefan@webrtc.org | 6696fba | 2013-05-29 12:12:51 +0000 | [diff] [blame] | 47 | |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 48 | void StartReceive(); |
| 49 | void StopReceive(); |
| 50 | |
| 51 | int StartRTPDump(const char file_nameUTF8[1024]); |
| 52 | int StopRTPDump(); |
| 53 | |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 54 | // Receives packets from external transport. |
| 55 | int ReceivedRTPPacket(const void* rtp_packet, int rtp_packet_length); |
| 56 | int ReceivedRTCPPacket(const void* rtcp_packet, int rtcp_packet_length); |
| 57 | |
| 58 | // Implements RtpData. |
pbos@webrtc.org | 67879bc | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 59 | virtual int32_t OnReceivedPayloadData( |
| 60 | const uint8_t* payload_data, |
| 61 | const uint16_t payload_size, |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 62 | const WebRtcRTPHeader* rtp_header); |
| 63 | |
mflodman@webrtc.org | cd1ac8b | 2013-02-06 17:46:39 +0000 | [diff] [blame] | 64 | void EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const; |
stefan@webrtc.org | 2a5dbce | 2013-02-01 14:33:42 +0000 | [diff] [blame] | 65 | |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 66 | private: |
pbos@webrtc.org | 67879bc | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 67 | int InsertRTPPacket(const int8_t* rtp_packet, int rtp_packet_length); |
| 68 | int InsertRTCPPacket(const int8_t* rtcp_packet, int rtcp_packet_length); |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 69 | |
| 70 | scoped_ptr<CriticalSectionWrapper> receive_cs_; |
| 71 | const int32_t channel_id_; |
stefan@webrtc.org | 6696fba | 2013-05-29 12:12:51 +0000 | [diff] [blame] | 72 | scoped_ptr<RtpHeaderParser> rtp_header_parser_; |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 73 | RtpRtcp* rtp_rtcp_; |
| 74 | std::list<RtpRtcp*> rtp_rtcp_simulcast_; |
| 75 | VideoCodingModule* vcm_; |
| 76 | RemoteBitrateEstimator* remote_bitrate_estimator_; |
| 77 | |
| 78 | Encryption* external_decryption_; |
pbos@webrtc.org | 67879bc | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 79 | uint8_t* decryption_buffer_; |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 80 | RtpDump* rtp_dump_; |
| 81 | bool receiving_; |
| 82 | }; |
| 83 | |
| 84 | } // namespace webrt |
| 85 | |
| 86 | #endif // WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_ |