blob: 904a951433d9858833b833ae8b24908ba83050ba [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
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.org065b64d2013-04-02 20:37:14 +000016#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.orgb015cbe2012-10-22 18:19:23 +000021
22namespace webrtc {
23
24class CriticalSectionWrapper;
25class Encryption;
26class RemoteBitrateEstimator;
27class RtpDump;
stefan@webrtc.org6696fba2013-05-29 12:12:51 +000028class RtpHeaderParser;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000029class RtpRtcp;
30class VideoCodingModule;
31
pwestin@webrtc.org065b64d2013-04-02 20:37:14 +000032class ViEReceiver : public RtpData {
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000033 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.org4e5f9832013-05-29 13:28:21 +000045 bool SetReceiveTimestampOffsetStatus(bool enable, int id);
46 bool SetReceiveAbsoluteSendTimeStatus(bool enable, int id);
stefan@webrtc.org6696fba2013-05-29 12:12:51 +000047
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000048 void StartReceive();
49 void StopReceive();
50
51 int StartRTPDump(const char file_nameUTF8[1024]);
52 int StopRTPDump();
53
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000054 // 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.org67879bc2013-04-09 13:41:51 +000059 virtual int32_t OnReceivedPayloadData(
60 const uint8_t* payload_data,
61 const uint16_t payload_size,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000062 const WebRtcRTPHeader* rtp_header);
63
mflodman@webrtc.orgcd1ac8b2013-02-06 17:46:39 +000064 void EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const;
stefan@webrtc.org2a5dbce2013-02-01 14:33:42 +000065
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000066 private:
pbos@webrtc.org67879bc2013-04-09 13:41:51 +000067 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.orgb015cbe2012-10-22 18:19:23 +000069
70 scoped_ptr<CriticalSectionWrapper> receive_cs_;
71 const int32_t channel_id_;
stefan@webrtc.org6696fba2013-05-29 12:12:51 +000072 scoped_ptr<RtpHeaderParser> rtp_header_parser_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000073 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.org67879bc2013-04-09 13:41:51 +000079 uint8_t* decryption_buffer_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000080 RtpDump* rtp_dump_;
81 bool receiving_;
82};
83
84} // namespace webrt
85
86#endif // WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_