blob: 199696cfca24236a7696dae1cb193f1bf5124f7e [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org39e96592012-03-01 18:22:48 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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.orge06ca3c2012-06-29 13:20:14 +000011#ifndef WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_
12#define WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000014#include <list>
15
pwestin@webrtc.org82dcc9f2013-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"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000022namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000023
niklase@google.com470e71d2011-07-07 08:21:25 +000024class CriticalSectionWrapper;
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000025class Encryption;
stefan@webrtc.org976a7e62012-09-21 13:20:21 +000026class RemoteBitrateEstimator;
niklase@google.com470e71d2011-07-07 08:21:25 +000027class RtpDump;
28class RtpRtcp;
29class VideoCodingModule;
niklase@google.com470e71d2011-07-07 08:21:25 +000030
pwestin@webrtc.org82dcc9f2013-04-02 20:37:14 +000031class ViEReceiver : public RtpData {
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000032 public:
stefan@webrtc.org976a7e62012-09-21 13:20:21 +000033 ViEReceiver(const int32_t channel_id, VideoCodingModule* module_vcm,
34 RemoteBitrateEstimator* remote_bitrate_estimator);
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000035 ~ViEReceiver();
niklase@google.com470e71d2011-07-07 08:21:25 +000036
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000037 int RegisterExternalDecryption(Encryption* decryption);
38 int DeregisterExternalDecryption();
niklase@google.com470e71d2011-07-07 08:21:25 +000039
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000040 void SetRtpRtcpModule(RtpRtcp* module);
41
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000042 void RegisterSimulcastRtpRtcpModules(const std::list<RtpRtcp*>& rtp_modules);
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000043
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000044 void StartReceive();
45 void StopReceive();
niklase@google.com470e71d2011-07-07 08:21:25 +000046
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000047 int StartRTPDump(const char file_nameUTF8[1024]);
48 int StopRTPDump();
niklase@google.com470e71d2011-07-07 08:21:25 +000049
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000050 // 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.com470e71d2011-07-07 08:21:25 +000053
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000054 // 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.com470e71d2011-07-07 08:21:25 +000059
stefan@webrtc.org976a7e62012-09-21 13:20:21 +000060 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.org4fd55272013-02-06 17:46:39 +000066 void EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const;
stefan@webrtc.orgb5865072013-02-01 14:33:42 +000067
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000068 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.com470e71d2011-07-07 08:21:25 +000071
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000072 scoped_ptr<CriticalSectionWrapper> receive_cs_;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000073 const int32_t channel_id_;
74 RtpRtcp* rtp_rtcp_;
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000075 std::list<RtpRtcp*> rtp_rtcp_simulcast_;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000076 VideoCodingModule* vcm_;
stefan@webrtc.org976a7e62012-09-21 13:20:21 +000077 RemoteBitrateEstimator* remote_bitrate_estimator_;
niklase@google.com470e71d2011-07-07 08:21:25 +000078
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000079 Encryption* external_decryption_;
80 WebRtc_UWord8* decryption_buffer_;
81 RtpDump* rtp_dump_;
82 bool receiving_;
niklase@google.com470e71d2011-07-07 08:21:25 +000083};
mflodman@webrtc.orgad4ee362011-11-28 22:39:24 +000084
85} // namespace webrt
86
mflodman@webrtc.orge06ca3c2012-06-29 13:20:14 +000087#endif // WEBRTC_VIDEO_ENGINE_VIE_RECEIVER_H_