andrew@webrtc.org | a7b57da | 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 | // ViESender is responsible for encrypting, if enabled, packets and send to |
| 12 | // network. |
| 13 | |
| 14 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_SENDER_H_ |
| 15 | #define WEBRTC_VIDEO_ENGINE_VIE_SENDER_H_ |
| 16 | |
| 17 | #include "common_types.h" // NOLINT |
| 18 | #include "engine_configurations.h" // NOLINT |
| 19 | #include "system_wrappers/interface/scoped_ptr.h" |
| 20 | #include "typedefs.h" // NOLINT |
| 21 | #include "video_engine/vie_defines.h" |
| 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | class CriticalSectionWrapper; |
| 26 | class RtpDump; |
| 27 | class Transport; |
| 28 | class VideoCodingModule; |
| 29 | |
| 30 | class ViESender: public Transport { |
| 31 | public: |
| 32 | explicit ViESender(const int32_t channel_id); |
| 33 | ~ViESender(); |
| 34 | |
| 35 | // Registers an encryption class to use before sending packets. |
| 36 | int RegisterExternalEncryption(Encryption* encryption); |
| 37 | int DeregisterExternalEncryption(); |
| 38 | |
| 39 | // Registers transport to use for sending RTP and RTCP. |
| 40 | int RegisterSendTransport(Transport* transport); |
| 41 | int DeregisterSendTransport(); |
| 42 | |
| 43 | // Stores all incoming packets to file. |
| 44 | int StartRTPDump(const char file_nameUTF8[1024]); |
| 45 | int StopRTPDump(); |
| 46 | |
| 47 | // Implements Transport. |
| 48 | virtual int SendPacket(int vie_id, const void* data, int len); |
| 49 | virtual int SendRTCPPacket(int vie_id, const void* data, int len); |
| 50 | |
| 51 | private: |
| 52 | const int32_t channel_id_; |
| 53 | |
| 54 | scoped_ptr<CriticalSectionWrapper> critsect_; |
| 55 | |
| 56 | Encryption* external_encryption_; |
| 57 | WebRtc_UWord8* encryption_buffer_; |
| 58 | Transport* transport_; |
| 59 | RtpDump* rtp_dump_; |
| 60 | }; |
| 61 | |
| 62 | } // namespace webrtc |
| 63 | |
| 64 | #endif // WEBRTC_VIDEO_ENGINE_VIE_SENDER_H_ |