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 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 14 | #include <list> |
| 15 | |
pwestin@webrtc.org | 82dcc9f | 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" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 22 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | class CriticalSectionWrapper; |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 25 | class Encryption; |
stefan@webrtc.org | 976a7e6 | 2012-09-21 13:20:21 +0000 | [diff] [blame] | 26 | class RemoteBitrateEstimator; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | class RtpDump; |
| 28 | class RtpRtcp; |
| 29 | class VideoCodingModule; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | |
pwestin@webrtc.org | 82dcc9f | 2013-04-02 20:37:14 +0000 | [diff] [blame^] | 31 | class ViEReceiver : public RtpData { |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 32 | public: |
stefan@webrtc.org | 976a7e6 | 2012-09-21 13:20:21 +0000 | [diff] [blame] | 33 | ViEReceiver(const int32_t channel_id, VideoCodingModule* module_vcm, |
| 34 | RemoteBitrateEstimator* remote_bitrate_estimator); |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 35 | ~ViEReceiver(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 37 | int RegisterExternalDecryption(Encryption* decryption); |
| 38 | int DeregisterExternalDecryption(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 40 | void SetRtpRtcpModule(RtpRtcp* module); |
| 41 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 42 | void RegisterSimulcastRtpRtcpModules(const std::list<RtpRtcp*>& rtp_modules); |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 43 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 44 | void StartReceive(); |
| 45 | void StopReceive(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 47 | int StartRTPDump(const char file_nameUTF8[1024]); |
| 48 | int StopRTPDump(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 50 | // Receives packets from external transport. |
| 51 | int ReceivedRTPPacket(const void* rtp_packet, int rtp_packet_length); |
| 52 | int ReceivedRTCPPacket(const void* rtcp_packet, int rtcp_packet_length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 54 | // Implements RtpData. |
| 55 | virtual WebRtc_Word32 OnReceivedPayloadData( |
| 56 | const WebRtc_UWord8* payload_data, |
| 57 | const WebRtc_UWord16 payload_size, |
| 58 | const WebRtcRTPHeader* rtp_header); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | |
stefan@webrtc.org | 976a7e6 | 2012-09-21 13:20:21 +0000 | [diff] [blame] | 60 | void OnSendReportReceived(const WebRtc_Word32 id, |
| 61 | const WebRtc_UWord32 senderSSRC, |
| 62 | uint32_t ntp_secs, |
| 63 | uint32_t ntp_frac, |
| 64 | uint32_t timestamp); |
| 65 | |
mflodman@webrtc.org | 4fd5527 | 2013-02-06 17:46:39 +0000 | [diff] [blame] | 66 | void EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const; |
stefan@webrtc.org | b586507 | 2013-02-01 14:33:42 +0000 | [diff] [blame] | 67 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 68 | private: |
| 69 | int InsertRTPPacket(const WebRtc_Word8* rtp_packet, int rtp_packet_length); |
| 70 | int InsertRTCPPacket(const WebRtc_Word8* rtcp_packet, int rtcp_packet_length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 72 | scoped_ptr<CriticalSectionWrapper> receive_cs_; |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 73 | const int32_t channel_id_; |
| 74 | RtpRtcp* rtp_rtcp_; |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 75 | std::list<RtpRtcp*> rtp_rtcp_simulcast_; |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 76 | VideoCodingModule* vcm_; |
stefan@webrtc.org | 976a7e6 | 2012-09-21 13:20:21 +0000 | [diff] [blame] | 77 | RemoteBitrateEstimator* remote_bitrate_estimator_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 79 | Encryption* external_decryption_; |
| 80 | WebRtc_UWord8* decryption_buffer_; |
| 81 | RtpDump* rtp_dump_; |
| 82 | bool receiving_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 83 | }; |
mflodman@webrtc.org | ad4ee36 | 2011-11-28 22:39:24 +0000 | [diff] [blame] | 84 | |
| 85 | } // namespace webrt |
| 86 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 87 | #endif // WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_ |