From d5a4d9bce6281b016703a941a736aac1549ab048 Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Mon, 2 Jan 2012 13:04:05 +0000 Subject: [PATCH] First refactoring of ViE interface. Review URL: http://webrtc-codereview.appspot.com/337003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1311 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/video_engine/include/vie_base.h | 186 ++++---- src/video_engine/include/vie_capture.h | 323 +++++++------ src/video_engine/include/vie_codec.h | 243 +++++----- src/video_engine/include/vie_encryption.h | 62 ++- src/video_engine/include/vie_errors.h | 196 ++++---- src/video_engine/include/vie_external_codec.h | 61 ++- src/video_engine/include/vie_file.h | 324 +++++++------ src/video_engine/include/vie_image_process.h | 131 +++--- src/video_engine/include/vie_network.h | 307 ++++++------- src/video_engine/include/vie_render.h | 136 +++--- src/video_engine/include/vie_rtp_rtcp.h | 433 +++++++++--------- 11 files changed, 1164 insertions(+), 1238 deletions(-) diff --git a/src/video_engine/include/vie_base.h b/src/video_engine/include/vie_base.h index 2e6731af9c..2757a78592 100644 --- a/src/video_engine/include/vie_base.h +++ b/src/video_engine/include/vie_base.h @@ -12,142 +12,126 @@ // // - Creating and deleting VideoEngine instances. // - Creating and deleting channels. -// - Connect a video channel with a corresponding voice channel for audio/video synchronization. +// - Connect a video channel with a corresponding voice channel for audio/video +// synchronization. // - Start and stop sending and receiving. - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_BASE_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_BASE_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_BASE_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_BASE_H_ #include "common_types.h" - -// Forward declarations -namespace webrtc -{ +namespace webrtc { class VoiceEngine; -// ---------------------------------------------------------------------------- -// VideoEngine Callbacks -// ---------------------------------------------------------------------------- +// Class used for all callbacks from ViEBase. +class WEBRTC_DLLEXPORT ViEBaseObserver { + public: + // This method will be called periodically if the average system CPU usage + // exceeds 75%. + virtual void PerformanceAlarm(const unsigned int cpu_load) = 0; -class WEBRTC_DLLEXPORT ViEBaseObserver -{ -public: - // This method will be called periodically if the average system CPU usage - // exceeds 75%. - virtual void PerformanceAlarm(const unsigned int cpuLoad) = 0; - -protected: - virtual ~ViEBaseObserver() {}; + protected: + virtual ~ViEBaseObserver() {} }; -// ---------------------------------------------------------------------------- -// VideoEngine -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT VideoEngine { + public: + // Creates a VideoEngine object, which can then be used to acquire sub‐APIs. + static VideoEngine* Create(); -class WEBRTC_DLLEXPORT VideoEngine -{ -public: - // Creates a VideoEngine object, which can then be used to acquire sub‐APIs. - static VideoEngine* Create(); + // Deletes a VideoEngine instance. + static bool Delete(VideoEngine*& video_engine); - // Deletes a VideoEngine instance. - static bool Delete(VideoEngine*& videoEngine); + // Specifies the amount and type of trace information, which will be created + // by the VideoEngine. + static int SetTraceFilter(const unsigned int filter); - // Specifies the amount and type of trace information, which will be created - // by the VideoEngine. - static int SetTraceFilter(const unsigned int filter); + // Sets the name of the trace file and enables non‐encrypted trace messages. + static int SetTraceFile(const char* file_nameUTF8, + const bool add_file_counter = false); - // Sets the name of the trace file and enables non‐encrypted trace messages. - static int SetTraceFile(const char* fileNameUTF8, - const bool addFileCounter = false); + // Installs the TraceCallback implementation to ensure that the VideoEngine + // user receives callbacks for generated trace messages. + static int SetTraceCallback(TraceCallback* callback); - // Installs the TraceCallback implementation to ensure that the VideoEngine - // user receives callbacks for generated trace messages. - static int SetTraceCallback(TraceCallback* callback); + // Android specific. + // Provides VideoEngine with pointers to objects supplied by the Java + // applications JNI interface. + static int SetAndroidObjects(void* java_vm, void* java_context); - // Android specific - // Provides VideoEngine with pointers to objects supplied by the Java - // applications JNI interface. - static int SetAndroidObjects(void* javaVM, void* javaContext); - -protected: - VideoEngine() {}; - virtual ~VideoEngine() {}; + protected: + VideoEngine() {} + virtual ~VideoEngine() {} }; -// ---------------------------------------------------------------------------- -// VideoBase -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViEBase { + public: + // Factory for the ViEBase sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViEBase* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViEBase -{ -public: - // Factory for the ViEBase sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViEBase* GetInterface(VideoEngine* videoEngine); + // Releases the ViEBase sub-API and decreases an internal reference counter. + // Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViEBase sub-API and decreases an internal reference counter. - // Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Initiates all common parts of the VideoEngine. + virtual int Init() = 0; - // Initiates all common parts of the VideoEngine. - virtual int Init() = 0; + // Connects a VideoEngine instance to a VoiceEngine instance for audio video + // synchronization. + virtual int SetVoiceEngine(VoiceEngine* voice_engine) = 0; - // Connects a VideoEngine instance to a VoiceEngine instance for audio video - // synchronization. - virtual int SetVoiceEngine(VoiceEngine* ptrVoiceEngine) = 0; + // Creates a new channel, either with a new encoder instance or by sharing + // encoder instance with an already created channel. + virtual int CreateChannel(int& video_channel) = 0; + virtual int CreateChannel(int& video_channel, int original_channel) = 0; - // Creates a new channel, either with a new encoder instance or by sharing - // encoder instance with an already created channel. - virtual int CreateChannel(int& videoChannel) = 0; - virtual int CreateChannel(int& videoChannel, int originalChannel) = 0; + // Deletes an existing channel and releases the utilized resources. + virtual int DeleteChannel(const int video_channel) = 0; - // Deletes an existing channel and releases the utilized resources. - virtual int DeleteChannel(const int videoChannel) = 0; + // Specifies the VoiceEngine and VideoEngine channel pair to use for + // audio/video synchronization. + virtual int ConnectAudioChannel(const int video_channel, + const int audio_channel) = 0; - // Specifies the VoiceEngine and VideoEngine channel pair to use for - // audio/video synchronization. - virtual int ConnectAudioChannel(const int videoChannel, - const int audioChannel) = 0; + // Disconnects a previously paired VideoEngine and VoiceEngine channel pair. + virtual int DisconnectAudioChannel(const int video_channel) = 0; - // Disconnects a previously paired VideoEngine and VoiceEngine channel pair. - virtual int DisconnectAudioChannel(const int videoChannel) = 0; + // Starts sending packets to an already specified IP address and port number + // for a specified channel. + virtual int StartSend(const int video_channel) = 0; - // Starts sending packets to an already specified IP address and port number - // for a specified channel. - virtual int StartSend(const int videoChannel) = 0; + // Stops packets from being sent for a specified channel. + virtual int StopSend(const int video_channel) = 0; - // Stops packets from being sent for a specified channel. - virtual int StopSend(const int videoChannel) = 0; + // Prepares VideoEngine for receiving packets on the specified channel. + virtual int StartReceive(const int video_channel) = 0; - // Prepares VideoEngine for receiving packets on the specified channel. - virtual int StartReceive(const int videoChannel) = 0; + // Stops receiving incoming RTP and RTCP packets on the specified channel. + virtual int StopReceive(const int video_channel) = 0; - // Stops receiving incoming RTP and RTCP packets on the specified channel. - virtual int StopReceive(const int videoChannel) = 0; + // Registers an instance of a user implementation of the ViEBase + // observer. + virtual int RegisterObserver(ViEBaseObserver& observer) = 0; - // Registers an instance of a user implementation of the ViEBase - // observer. - virtual int RegisterObserver(ViEBaseObserver& observer) = 0; + // Removes an already registered instance of ViEBaseObserver. + virtual int DeregisterObserver() = 0; - // Removes an already registered instance of ViEBaseObserver. - virtual int DeregisterObserver() = 0; + // Retrieves the version information for VideoEngine and its components. + virtual int GetVersion(char version[1024]) = 0; - // Retrieves the version information for VideoEngine and its components. - virtual int GetVersion(char version[1024]) = 0; + // Returns the last VideoEngine error code. + virtual int LastError() = 0; - // Returns the last VideoEngine error code. - virtual int LastError() = 0; - -protected: - ViEBase() {}; - virtual ~ViEBase(){}; + protected: + ViEBase() {} + virtual ~ViEBase() {} }; -} // namespace webrtc +} // namespace webrtc + #endif // #define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_BASE_H_ diff --git a/src/video_engine/include/vie_capture.h b/src/video_engine/include/vie_capture.h index 7c7d14a76b..dad97097e8 100644 --- a/src/video_engine/include/vie_capture.h +++ b/src/video_engine/include/vie_capture.h @@ -15,66 +15,58 @@ // - Start and stop capture devices. // - Getting capture device capabilities. - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CAPTURE_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CAPTURE_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_CAPTURE_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_CAPTURE_H_ #include "common_types.h" -namespace webrtc -{ +namespace webrtc { class VideoEngine; class VideoCaptureModule; // This structure describes one set of the supported capabilities for a capture // device. -struct CaptureCapability -{ - unsigned int width; - unsigned int height; - unsigned int maxFPS; - RawVideoType rawType; - VideoCodecType codecType; - unsigned int expectedCaptureDelay; - bool interlaced; - CaptureCapability() - { - width = 0; - height = 0; - maxFPS = 0; - rawType = kVideoI420; - codecType = kVideoCodecUnknown; - expectedCaptureDelay = 0; - interlaced = false; - } +struct CaptureCapability { + unsigned int width; + unsigned int height; + unsigned int maxFPS; + RawVideoType rawType; + VideoCodecType codecType; + unsigned int expectedCaptureDelay; + bool interlaced; + CaptureCapability() { + width = 0; + height = 0; + maxFPS = 0; + rawType = kVideoI420; + codecType = kVideoCodecUnknown; + expectedCaptureDelay = 0; + interlaced = false; + } }; // This enumerator tells the current brightness alarm mode. -enum Brightness -{ - Normal = 0, - Bright = 1, - Dark = 2 +enum Brightness { + Normal = 0, + Bright = 1, + Dark = 2 }; // This enumerator describes the capture alarm mode. -enum CaptureAlarm -{ - AlarmRaised = 0, - AlarmCleared = 1 +enum CaptureAlarm { + AlarmRaised = 0, + AlarmCleared = 1 }; -enum RotateCapturedFrame -{ - RotateCapturedFrame_0 = 0, - RotateCapturedFrame_90 = 90, - RotateCapturedFrame_180 = 180, - RotateCapturedFrame_270 = 270 +enum RotateCapturedFrame { + RotateCapturedFrame_0 = 0, + RotateCapturedFrame_90 = 90, + RotateCapturedFrame_180 = 180, + RotateCapturedFrame_270 = 270 }; -struct ViEVideoFrameI420 -{ +struct ViEVideoFrameI420 { ViEVideoFrameI420() { y_plane = NULL; u_plane = NULL; @@ -104,165 +96,160 @@ struct ViEVideoFrameI420 // in the ViECapture interface, which will create a suitable implementation. // The user should then call IncomingFrame in this interface to deliver // captured frames to the system. -class WEBRTC_DLLEXPORT ViEExternalCapture -{ -public: - ViEExternalCapture() {} - virtual ~ViEExternalCapture() {} +class WEBRTC_DLLEXPORT ViEExternalCapture { + public: + ViEExternalCapture() {} + virtual ~ViEExternalCapture() {} - // This method is called by the user to deliver a new captured frame to - // VideoEngine. - virtual int IncomingFrame(unsigned char* videoFrame, - unsigned int videoFrameLength, - unsigned short width, unsigned short height, - RawVideoType videoType, - unsigned long long captureTime = 0) = 0; + // This method is called by the user to deliver a new captured frame to + // VideoEngine. + virtual int IncomingFrame(unsigned char* video_frame, + unsigned int video_frame_length, + unsigned short width, + unsigned short height, + RawVideoType video_type, + unsigned long long capture_time = 0) = 0; - // This method is specifically for delivering a new captured I420 frame to - // VideoEngine. - virtual int IncomingFrameI420( - const ViEVideoFrameI420& video_frame, - unsigned long long captureTime = 0) = 0; + // This method is specifically for delivering a new captured I420 frame to + // VideoEngine. + virtual int IncomingFrameI420( + const ViEVideoFrameI420& video_frame, + unsigned long long capture_time = 0) = 0; }; -// ---------------------------------------------------------------------------- -// ViECaptureObserver -// ---------------------------------------------------------------------------- - // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterObserver() and // deregistered using DeregisterObserver(). -class WEBRTC_DLLEXPORT ViECaptureObserver -{ -public: - // This method is called if a bright or dark captured image is detected. - virtual void BrightnessAlarm(const int captureId, - const Brightness brightness) = 0; +class WEBRTC_DLLEXPORT ViECaptureObserver { + public: + // This method is called if a bright or dark captured image is detected. + virtual void BrightnessAlarm(const int capture_id, + const Brightness brightness) = 0; - // This method is called periodically telling the capture device frame rate. - virtual void CapturedFrameRate(const int captureId, - const unsigned char frameRate) = 0; + // This method is called periodically telling the capture device frame rate. + virtual void CapturedFrameRate(const int capture_id, + const unsigned char frame_rate) = 0; - // This method is called if the capture device stops delivering images to - // VideoEngine. - virtual void NoPictureAlarm(const int captureId, - const CaptureAlarm alarm) = 0; + // This method is called if the capture device stops delivering images to + // VideoEngine. + virtual void NoPictureAlarm(const int capture_id, + const CaptureAlarm alarm) = 0; -protected: - virtual ~ViECaptureObserver() - { - } + protected: + virtual ~ViECaptureObserver() {} }; -// ---------------------------------------------------------------------------- -// ViECapture -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViECapture { + public: + // Factory for the ViECapture sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViECapture* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViECapture -{ -public: - // Factory for the ViECapture sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViECapture* GetInterface(VideoEngine* videoEngine); + // Releases the ViECapture sub-API and decreases an internal reference + // counter. + // Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViECapture sub-API and decreases an internal reference - // counter. - // Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Gets the number of available capture devices. + virtual int NumberOfCaptureDevices() = 0; + // Gets the name and unique id of a capture device. + virtual int GetCaptureDevice(unsigned int list_number, + char* device_nameUTF8, + const unsigned int device_nameUTF8Length, + char* unique_idUTF8, + const unsigned int unique_idUTF8Length) = 0; - // Gets the number of available capture devices. - virtual int NumberOfCaptureDevices() = 0; + // Allocates a capture device to be used in VideoEngine. + virtual int AllocateCaptureDevice(const char* unique_idUTF8, + const unsigned int unique_idUTF8Length, + int& capture_id) = 0; - // Gets the name and unique id of a capture device. - virtual int GetCaptureDevice(unsigned int listNumber, char* deviceNameUTF8, - const unsigned int deviceNameUTF8Length, - char* uniqueIdUTF8, - const unsigned int uniqueIdUTF8Length) = 0; + // Registers an external capture device to be used in VideoEngine + virtual int AllocateExternalCaptureDevice( + int& capture_id, + ViEExternalCapture *&external_capture) = 0; - // Allocates a capture device to be used in VideoEngine. - virtual int AllocateCaptureDevice(const char* uniqueIdUTF8, - const unsigned int uniqueIdUTF8Length, - int& captureId) = 0; + // Use capture device using external capture module. + virtual int AllocateCaptureDevice(VideoCaptureModule& capture_module, + int& capture_id) = 0; - // Registers an external capture device to be used in VideoEngine - virtual int AllocateExternalCaptureDevice( - int& captureId, ViEExternalCapture *&externalCapture) = 0; + // Releases a capture device and makes it available for other applications. + virtual int ReleaseCaptureDevice(const int capture_id) = 0; - // Use capture device using external capture module. - virtual int AllocateCaptureDevice(VideoCaptureModule& captureModule, - int& captureId) = 0; + // This function connects a capture device with a channel. Multiple channels + // can be connected to the same capture device. + virtual int ConnectCaptureDevice(const int capture_id, + const int video_channel) = 0; - // Releases a capture device and makes it available for other applications. - virtual int ReleaseCaptureDevice(const int captureId) = 0; + // Disconnects a capture device as input for a specified channel. + virtual int DisconnectCaptureDevice(const int video_channel) = 0; - // This function connects a capture device with a channel. Multiple channels - // can be connected to the same capture device. - virtual int ConnectCaptureDevice(const int captureId, - const int videoChannel) = 0; + // Makes a capture device start capturing video frames. + virtual int StartCapture( + const int capture_id, + const CaptureCapability capture_capability = CaptureCapability()) = 0; - // Disconnects a capture device as input for a specified channel. - virtual int DisconnectCaptureDevice(const int videoChannel) = 0; + // Stops a started capture device from capturing video frames. + virtual int StopCapture(const int capture_id) = 0; - // Makes a capture device start capturing video frames. - virtual int StartCapture(const int captureId, - const CaptureCapability captureCapability = - CaptureCapability()) = 0; + // Rotates captured frames before encoding and sending. + // Used on mobile devices with rotates cameras. + virtual int SetRotateCapturedFrames(const int capture_id, + const RotateCapturedFrame rotation) = 0; - // Stops a started capture device from capturing video frames. - virtual int StopCapture(const int captureId) = 0; + // This function sets the expected delay from when a video frame is captured + // to when that frame is delivered to VideoEngine. + virtual int SetCaptureDelay(const int capture_id, + const unsigned int capture_delay_ms) = 0; - // Rotates captured frames before encoding and sending. - // Used on mobile devices with rotates cameras. - virtual int SetRotateCapturedFrames(const int captureId, - const RotateCapturedFrame rotation) = 0; + // Returns the number of sets of capture capabilities the capture device + // supports. + virtual int NumberOfCapabilities( + const char* unique_id_utf8, + const unsigned int unique_id_utf8_length) = 0; - // This function sets the expected delay from when a video frame is captured - // to when that frame is delivered to VideoEngine. - virtual int SetCaptureDelay(const int captureId, - const unsigned int captureDelayMs) = 0; + // Gets a set of capture capabilities for a specified capture device. + virtual int GetCaptureCapability(const char* unique_id_utf8, + const unsigned int unique_id_utf8_length, + const unsigned int capability_number, + CaptureCapability& capability) = 0; - // Returns the number of sets of capture capabilities the capture device - // supports. - virtual int NumberOfCapabilities(const char* uniqueIdUTF8, - const unsigned int uniqueIdUTF8Length) = 0; + // Displays the capture device property dialog box for the specified capture + // device. Windows only. + virtual int ShowCaptureSettingsDialogBox( + const char* unique_idUTF8, + const unsigned int unique_id_utf8_length, + const char* dialog_title, + void* parent_window = NULL, + const unsigned int x = 200, + const unsigned int y = 200) = 0; - // Gets a set of capture capabilities for a specified capture device. - virtual int GetCaptureCapability(const char* uniqueIdUTF8, - const unsigned int uniqueIdUTF8Length, - const unsigned int capabilityNumber, - CaptureCapability& capability) = 0; + // Gets the clockwise angle the frames from the camera must be rotated in + // order to display the frames correctly if the display is rotated in its + // natural orientation. + virtual int GetOrientation(const char* unique_id_utf8, + RotateCapturedFrame& orientation) = 0; - // Displays the capture device property dialog box for the specified capture - // device. Windows only. - virtual int ShowCaptureSettingsDialogBox( - const char* uniqueIdUTF8, const unsigned int uniqueIdUTF8Length, - const char* dialogTitle, void* parentWindow = NULL, - const unsigned int x = 200, const unsigned int y = 200) = 0; + // Enables brightness alarm detection and the brightness alarm callback. + virtual int EnableBrightnessAlarm(const int capture_id, + const bool enable) = 0; - // Gets the clockwise angle the frames from the camera must be rotated in - // order to display the frames correctly if the display is rotated in its - // natural orientation. - virtual int GetOrientation(const char* uniqueIdUTF8, - RotateCapturedFrame &orientation) = 0; + // Registers an instance of a user implementation of the ViECaptureObserver. + virtual int RegisterObserver(const int capture_id, + ViECaptureObserver& observer) = 0; - // Enables brightness alarm detection and the brightness alarm callback. - virtual int EnableBrightnessAlarm(const int captureId, - const bool enable) = 0; + // Removes an already registered instance of ViECaptureObserver. + virtual int DeregisterObserver(const int capture_id) = 0; - // Registers an instance of a user implementation of the ViECaptureObserver. - virtual int RegisterObserver(const int captureId, - ViECaptureObserver& observer) = 0; - - // Removes an already registered instance of ViECaptureObserver. - virtual int DeregisterObserver(const int captureId) = 0; - -protected: - ViECapture() {}; - virtual ~ViECapture() {}; + protected: + ViECapture() {} + virtual ~ViECapture() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CAPTURE_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_CAPTURE_H_ diff --git a/src/video_engine/include/vie_codec.h b/src/video_engine/include/vie_codec.h index dded4598fb..1344848f97 100644 --- a/src/video_engine/include/vie_codec.h +++ b/src/video_engine/include/vie_codec.h @@ -14,176 +14,163 @@ // - Key frame signaling. // - Stream management settings. -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CODEC_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CODEC_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_CODEC_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_CODEC_H_ #include "common_types.h" -namespace webrtc -{ +namespace webrtc { class VideoEngine; struct VideoCodec; -// ---------------------------------------------------------------------------- -// ViEEncoderObserver -// ---------------------------------------------------------------------------- - // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterEncoderObserver() // and deregistered using DeregisterEncoderObserver(). -class WEBRTC_DLLEXPORT ViEEncoderObserver -{ -public: - // This method is called once per second with the current encoded frame rate - // and bit rate. - virtual void OutgoingRate(const int videoChannel, - const unsigned int framerate, - const unsigned int bitrate) = 0; -protected: - virtual ~ViEEncoderObserver() {}; +class WEBRTC_DLLEXPORT ViEEncoderObserver { + public: + // This method is called once per second with the current encoded frame rate + // and bit rate. + virtual void OutgoingRate(const int video_channel, + const unsigned int framerate, + const unsigned int bitrate) = 0; + protected: + virtual ~ViEEncoderObserver() {} }; -// ---------------------------------------------------------------------------- -// ViEEncoderObserver -// ---------------------------------------------------------------------------- - // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterDecoderObserver() // and deregistered using DeregisterDecoderObserver(). -class WEBRTC_DLLEXPORT ViEDecoderObserver -{ -public: - // This method is called when a new incoming stream is detected, normally - // triggered by a new incoming SSRC or payload type. - virtual void IncomingCodecChanged(const int videoChannel, - const VideoCodec& videoCodec) = 0; +class WEBRTC_DLLEXPORT ViEDecoderObserver { + public: + // This method is called when a new incoming stream is detected, normally + // triggered by a new incoming SSRC or payload type. + virtual void IncomingCodecChanged(const int video_channel, + const VideoCodec& video_codec) = 0; - // This method is called once per second containing the frame rate and bit - // rate for the incoming stream - virtual void IncomingRate(const int videoChannel, - const unsigned int framerate, - const unsigned int bitrate) = 0; + // This method is called once per second containing the frame rate and bit + // rate for the incoming stream + virtual void IncomingRate(const int video_channel, + const unsigned int framerate, + const unsigned int bitrate) = 0; - // This method is called when the decoder needs a new key frame from encoder - // on the sender. - virtual void RequestNewKeyFrame(const int videoChannel) = 0; + // This method is called when the decoder needs a new key frame from encoder + // on the sender. + virtual void RequestNewKeyFrame(const int video_channel) = 0; -protected: - virtual ~ViEDecoderObserver() {}; + protected: + virtual ~ViEDecoderObserver() {} }; -// ---------------------------------------------------------------------------- -// ViECodec -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViECodec { + public: + // Factory for the ViECodec sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViECodec* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViECodec -{ -public: - // Factory for the ViECodec sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViECodec* GetInterface(VideoEngine* videoEngine); + // Releases the ViECodec sub-API and decreases an internal reference + // counter. + // Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViECodec sub-API and decreases an internal reference - // counter. - // Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Gets the number of available codecs for the VideoEngine build. + virtual int NumberOfCodecs() const = 0; - // Gets the number of available codecs for the VideoEngine build. - virtual int NumberOfCodecs() const = 0; + // Gets a VideoCodec struct for a codec containing the default configuration + // for that codec type. + virtual int GetCodec(const unsigned char list_number, + VideoCodec& video_codec) const = 0; - // Gets a VideoCodec struct for a codec containing the default configuration - // for that codec type. - virtual int GetCodec(const unsigned char listNumber, - VideoCodec& videoCodec) const = 0; + // Sets the send codec to use for a specified channel. + virtual int SetSendCodec(const int video_channel, + const VideoCodec& video_codec) = 0; - // Sets the send codec to use for a specified channel. - virtual int SetSendCodec(const int videoChannel, - const VideoCodec& videoCodec) = 0; + // Gets the current send codec settings. + virtual int GetSendCodec(const int video_channel, + VideoCodec& video_codec) const = 0; - // Gets the current send codec settings. - virtual int GetSendCodec(const int videoChannel, - VideoCodec& videoCodec) const = 0; + // Prepares VideoEngine to receive a certain codec type and setting for a + // specified payload type. + virtual int SetReceiveCodec(const int video_channel, + const VideoCodec& video_codec) = 0; - // Prepares VideoEngine to receive a certain codec type and setting for a - // specified payload type. - virtual int SetReceiveCodec(const int videoChannel, - const VideoCodec& videoCodec) = 0; + // Gets the current receive codec. + virtual int GetReceiveCodec(const int video_channel, + VideoCodec& video_codec) const = 0; - // Gets the current receive codec. - virtual int GetReceiveCodec(const int videoChannel, - VideoCodec& videoCodec) const = 0; + // This function is used to get codec configuration parameters to be + // signaled from the encoder to the decoder in the call setup. + virtual int GetCodecConfigParameters( + const int video_channel, + unsigned char config_parameters[kConfigParameterSize], + unsigned char& config_parameters_size) const = 0; - // This function is used to get codec configuration parameters to be - // signaled from the encoder to the decoder in the call setup. - virtual int GetCodecConfigParameters( - const int videoChannel, - unsigned char configParameters[kConfigParameterSize], - unsigned char& configParametersSize) const = 0; + // Enables advanced scaling of the captured video stream if the stream + // differs from the send codec settings. + virtual int SetImageScaleStatus(const int video_channel, + const bool enable) = 0; - // Enables advanced scaling of the captured video stream if the stream - // differs from the send codec settings. - virtual int SetImageScaleStatus(const int videoChannel, - const bool enable) = 0; + // Gets the number of sent key frames and number of sent delta frames. + virtual int GetSendCodecStastistics(const int video_channel, + unsigned int& key_frames, + unsigned int& delta_frames) const = 0; - // Gets the number of sent key frames and number of sent delta frames. - virtual int GetSendCodecStastistics(const int videoChannel, - unsigned int& keyFrames, - unsigned int& deltaFrames) const = 0; + // Gets the number of decoded key frames and number of decoded delta frames. + virtual int GetReceiveCodecStastistics(const int video_channel, + unsigned int& key_frames, + unsigned int& delta_frames) const = 0; - // Gets the number of decoded key frames and number of decoded delta frames. - virtual int GetReceiveCodecStastistics(const int videoChannel, - unsigned int& keyFrames, - unsigned int& deltaFrames) const = 0; + // Gets the number of packets discarded by the jitter buffer because they + // arrived too late. + virtual unsigned int GetDiscardedPackets(const int video_channel) const = 0; - // Gets the number of packets discarded by the jitter buffer because they - // arrived too late. - virtual unsigned int GetDiscardedPackets(const int videoChannel) const = 0; + // Enables key frame request callback in ViEDecoderObserver. + virtual int SetKeyFrameRequestCallbackStatus(const int video_channel, + const bool enable) = 0; - // Enables key frame request callback in ViEDecoderObserver. - virtual int SetKeyFrameRequestCallbackStatus(const int videoChannel, - const bool enable) = 0; + // Enables key frame requests for detected lost packets. + virtual int SetSignalKeyPacketLossStatus( + const int video_channel, + const bool enable, + const bool only_key_frames = false) = 0; - // Enables key frame requests for detected lost packets. - virtual int SetSignalKeyPacketLossStatus( - const int videoChannel, const bool enable, - const bool onlyKeyFrames = false) = 0; + // Registers an instance of a user implementation of the ViEEncoderObserver. + virtual int RegisterEncoderObserver(const int video_channel, + ViEEncoderObserver& observer) = 0; - // Registers an instance of a user implementation of the ViEEncoderObserver. - virtual int RegisterEncoderObserver(const int videoChannel, - ViEEncoderObserver& observer) = 0; + // Removes an already registered instance of ViEEncoderObserver. + virtual int DeregisterEncoderObserver(const int video_channel) = 0; - // Removes an already registered instance of ViEEncoderObserver. - virtual int DeregisterEncoderObserver(const int videoChannel) = 0; + // Registers an instance of a user implementation of the ViEDecoderObserver. + virtual int RegisterDecoderObserver(const int video_channel, + ViEDecoderObserver& observer) = 0; - // Registers an instance of a user implementation of the ViEDecoderObserver. - virtual int RegisterDecoderObserver(const int videoChannel, - ViEDecoderObserver& observer) = 0; + // Removes an already registered instance of ViEDecoderObserver. + virtual int DeregisterDecoderObserver(const int video_channel) = 0; - // Removes an already registered instance of ViEDecoderObserver. - virtual int DeregisterDecoderObserver(const int videoChannel) = 0; + // This function forces the next encoded frame to be a key frame. This is + // normally used when the remote endpoint only supports out‐band key frame + // request. + virtual int SendKeyFrame(const int video_channel) = 0; - // This function forces the next encoded frame to be a key frame. This is - // normally used when the remote endpoint only supports out‐band key frame - // request. - virtual int SendKeyFrame(const int videoChannel) = 0; + // This function makes the decoder wait for a key frame before starting to + // decode the incoming video stream. + virtual int WaitForFirstKeyFrame(const int video_channel, + const bool wait) = 0; - // This function makes the decoder wait for a key frame before starting to - // decode the incoming video stream. - virtual int WaitForFirstKeyFrame(const int videoChannel, - const bool wait) = 0; + // This function makes VideoEngine decode all incoming H.263 key frames as + // delta frames and all incoming delta frames as key frames. + virtual int SetInverseH263Logic(int video_channel, bool enable) = 0; - // This function makes VideoEngine decode all incoming H.263 key frames as - // delta frames and all incoming delta frames as key frames. - virtual int SetInverseH263Logic(int videoChannel, bool enable) = 0; - -protected: - ViECodec() {}; - virtual ~ViECodec() {}; + protected: + ViECodec() {} + virtual ~ViECodec() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_CODEC_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_CODEC_H_ diff --git a/src/video_engine/include/vie_encryption.h b/src/video_engine/include/vie_encryption.h index 853c454293..8e7c955419 100644 --- a/src/video_engine/include/vie_encryption.h +++ b/src/video_engine/include/vie_encryption.h @@ -9,49 +9,43 @@ */ // This sub-API supports the following functionalities: -// - Secure RTP (SRTP). // - External encryption and decryption. - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ENCRYPTION_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ENCRYPTION_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_ENCRYPTION_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_ENCRYPTION_H_ #include "common_types.h" -namespace webrtc -{ +namespace webrtc { class VideoEngine; -// ---------------------------------------------------------------------------- -// ViEEncryption -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViEEncryption { + public: + // Factory for the ViEEncryption sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViEEncryption* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViEEncryption -{ -public: - // Factory for the ViEEncryption sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViEEncryption* GetInterface(VideoEngine* videoEngine); + // Releases the ViEEncryption sub-API and decreases an internal reference + // counter. + // Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViEEncryption sub-API and decreases an internal reference - // counter. - // Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // This function registers a encryption derived instance and enables + // external encryption for the specified channel. + virtual int RegisterExternalEncryption(const int video_channel, + Encryption& encryption) = 0; - // This function registers a encryption derived instance and enables - // external encryption for the specified channel. - virtual int RegisterExternalEncryption(const int videoChannel, - Encryption& encryption) = 0; + // This function deregisters a registered encryption derived instance + // and disables external encryption. + virtual int DeregisterExternalEncryption(const int video_channel) = 0; - // This function deregisters a registered encryption derived instance - // and disables external encryption. - virtual int DeregisterExternalEncryption(const int videoChannel) = 0; - -protected: - ViEEncryption() {}; - virtual ~ViEEncryption() {}; + protected: + ViEEncryption() {} + virtual ~ViEEncryption() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ENCRYPTION_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_ENCRYPTION_H_ diff --git a/src/video_engine/include/vie_errors.h b/src/video_engine/include/vie_errors.h index 96a6c9468b..63100b51d9 100644 --- a/src/video_engine/include/vie_errors.h +++ b/src/video_engine/include/vie_errors.h @@ -8,114 +8,112 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ERRORS_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ERRORS_H_ - +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_ERRORS_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_ERRORS_H_ enum ViEErrors { + // ViEBase. + kViENotInitialized = 12000, // Init has not been called successfully. + kViEBaseVoEFailure, // SetVoiceEngine. ViE failed to use VE instance. Check VE instance pointer.ConnectAudioChannel failed to set voice channel. Have SetVoiceEngine been called? Is the voice channel correct. + kViEBaseChannelCreationFailed, // CreateChannel. + kViEBaseInvalidChannelId, // The channel does not exist. + kViEAPIDoesNotExist, // Release called on Interface that has not been created. + kViEBaseInvalidArgument, + kViEBaseAlreadySending, // StartSend called on channel that is already sending. + kViEBaseNotSending, // StopSend called on channel that is not sending. + kViEBaseAlreadyReceiving, // StartReceive called on channel that is already receiving. + kViEBaseObserverAlreadyRegistered, // RegisterObserver- an observer has already been set. + kViEBaseObserverNotRegistered, // DeregisterObserver - no observer has been registered. + kViEBaseUnknownError, // An unknown error has occurred. Check the log file. - //ViEBase - kViENotInitialized = 12000, // Init has not been called successfully. - kViEBaseVoEFailure, // SetVoiceEngine. ViE failed to use VE instance. Check VE instance pointer.ConnectAudioChannel failed to set voice channel. Have SetVoiceEngine been called? Is the voice channel correct. - kViEBaseChannelCreationFailed, // CreateChannel. - kViEBaseInvalidChannelId, // The channel does not exist. - kViEAPIDoesNotExist, // Release called on Interface that has not been created. - kViEBaseInvalidArgument, - kViEBaseAlreadySending, // StartSend called on channel that is already sending. - kViEBaseNotSending, // StopSend called on channel that is not sending. - kViEBaseAlreadyReceiving, // StartReceive called on channel that is already receiving. - kViEBaseObserverAlreadyRegistered, // RegisterObserver- an observer has already been set. - kViEBaseObserverNotRegistered, // DeregisterObserver - no observer has been registered. - kViEBaseUnknownError, // An unknown error has occurred. Check the log file. + // ViECodec. + kViECodecInvalidArgument = 12100, // Wrong input parameter to function. + kViECodecObserverAlreadyRegistered, // RegisterEncoderObserver, RegisterDecoderObserver. + kViECodecObserverNotRegistered, // DeregisterEncoderObserver, DeregisterDecoderObserver. + kViECodecInvalidCodec, // SetSendCodec,SetReceiveCodec- The codec structure is invalid. + kViECodecInvalidChannelId, // The channel does not exist. + kViECodecInUse, // SetSendCodec- Can't change codec size or type when multiple channels use the same encoder. + kViECodecUnknownError, // An unknown error has occurred. Check the log file. - //ViECodec - kViECodecInvalidArgument = 12100, // Wrong input parameter to function. - kViECodecObserverAlreadyRegistered, // RegisterEncoderObserver, RegisterDecoderObserver. - kViECodecObserverNotRegistered, // DeregisterEncoderObserver, DeregisterDecoderObserver. - kViECodecInvalidCodec, // SetSendCodec,SetReceiveCodec- The codec structure is invalid. - kViECodecInvalidChannelId, // The channel does not exist. - kViECodecInUse, // SetSendCodec- Can't change codec size or type when multiple channels use the same encoder. - kViECodecUnknownError, // An unknown error has occurred. Check the log file. + // ViERender. + kViERenderInvalidRenderId = 12200, // No renderer with the ID exist. In AddRenderer - The render ID is invalid. No capture device, channel or file is allocated with that id. + kViERenderAlreadyExists, // AddRenderer: the renderer already exist. + kViERenderInvalidFrameFormat, // AddRender (external renderer). The user has requested a frame format that we don't support. + kViERenderUnknownError, // An unknown error has occurred. Check the log file. - //ViERender - kViERenderInvalidRenderId = 12200, // No renderer with the ID exist. In AddRenderer - The render ID is invalid. No capture device, channel or file is allocated with that id. - kViERenderAlreadyExists, // AddRenderer: the renderer already exist. - kViERenderInvalidFrameFormat, // AddRender (external renderer). The user has requested a frame format that we don't support. - kViERenderUnknownError, // An unknown error has occurred. Check the log file. + // ViECapture. + kViECaptureDeviceAlreadyConnected = 12300, // ConnectCaptureDevice - A capture device has already been connected to this video channel. + kViECaptureDeviceDoesNotExist, // No capture device exist with the provided capture id or unique name. + kViECaptureDeviceInvalidChannelId, // ConnectCaptureDevice, DisconnectCaptureDevice- No Channel exist with the provided channel id. + kViECaptureDeviceNotConnected, // DisconnectCaptureDevice- No capture device is connected to the channel. + kViECaptureDeviceNotStarted, // Stop- The capture device is not started. + kViECaptureDeviceAlreadyStarted, // Start- The capture device is already started. + kViECaptureDeviceAlreadyAllocated, // AllocateCaptureDevice The device is already allocated. + kViECaptureDeviceMaxNoDevicesAllocated, // AllocateCaptureDevice Max number of devices already allocated. + kViECaptureObserverAlreadyRegistered, // RegisterObserver- An observer is already registered. Need to deregister first. + kViECaptureDeviceObserverNotRegistered, // DeregisterObserver- No observer is registered. + kViECaptureDeviceUnknownError, // An unknown error has occurred. Check the log file. + kViECaptureDeviceMacQtkitNotSupported, // QTKit handles the capture devices automatically. Thus querying capture capabilities is not supported. - //ViECapture - kViECaptureDeviceAlreadyConnected = 12300, // ConnectCaptureDevice - A capture device has already been connected to this video channel. - kViECaptureDeviceDoesNotExist, // No capture device exist with the provided capture id or unique name. - kViECaptureDeviceInvalidChannelId, // ConnectCaptureDevice, DisconnectCaptureDevice- No Channel exist with the provided channel id. - kViECaptureDeviceNotConnected, // DisconnectCaptureDevice- No capture device is connected to the channel. - kViECaptureDeviceNotStarted, // Stop- The capture device is not started. - kViECaptureDeviceAlreadyStarted, // Start- The capture device is already started. - kViECaptureDeviceAlreadyAllocated, // AllocateCaptureDevice The device is already allocated. - kViECaptureDeviceMaxNoDevicesAllocated, // AllocateCaptureDevice Max number of devices already allocated. - kViECaptureObserverAlreadyRegistered, // RegisterObserver- An observer is already registered. Need to deregister first. - kViECaptureDeviceObserverNotRegistered, // DeregisterObserver- No observer is registered. - kViECaptureDeviceUnknownError, // An unknown error has occurred. Check the log file. - kViECaptureDeviceMacQtkitNotSupported, // QTKit handles the capture devices automatically. Thus querying capture capabilities is not supported. + // ViEFile. + kViEFileInvalidChannelId = 12400, // No Channel exist with the provided channel id. + kViEFileInvalidArgument, // Incorrect input argument + kViEFileAlreadyRecording, // StartRecordOutgoingVideo - already recording channel + kViEFileVoENotSet, // StartRecordOutgoingVideo. Failed to access voice engine. Has SetVoiceEngine been called? + kViEFileNotRecording, // StopRecordOutgoingVideo + kViEFileMaxNoOfFilesOpened, // StartPlayFile + kViEFileNotPlaying, // StopPlayFile. The file with the provided id is not playing. + kViEFileObserverAlreadyRegistered, // RegisterObserver + kViEFileObserverNotRegistered, // DeregisterObserver + kViEFileInputAlreadyConnected, // SendFileOnChannel- the video channel already have a connected input. + kViEFileNotConnected, // StopSendFileOnChannel- No file is being sent on the channel. + kViEFileVoEFailure, // SendFileOnChannel,StartPlayAudioLocally - failed to play audio stream + kViEFileInvalidRenderId, // SetRenderTimeoutImage and SetRenderStartImage: Renderer with the provided render id does not exist. + kViEFileInvalidFile, // Can't open the file with provided filename. Is the path and file format correct? + kViEFileInvalidCapture, // Can't use ViEPicture. Is the object correct? + kViEFileSetRenderTimeoutError, // SetRenderTimeoutImage- Please see log file. + kViEFileInvalidCaptureId, // SetCaptureDeviceImage capture id does not exist. + kViEFileSetCaptureImageError, // SetCaptureDeviceImage error. Please see log file. + kViEFileSetStartImageError, // SetRenderStartImage error. Please see log file. + kViEFileUnknownError, // An unknown error has occurred. Check the log file. - //ViEFile - kViEFileInvalidChannelId = 12400, // No Channel exist with the provided channel id. - kViEFileInvalidArgument, // Incorrect input argument - kViEFileAlreadyRecording, // StartRecordOutgoingVideo - already recording channel - kViEFileVoENotSet, // StartRecordOutgoingVideo. Failed to access voice engine. Has SetVoiceEngine been called? - kViEFileNotRecording, // StopRecordOutgoingVideo - kViEFileMaxNoOfFilesOpened, // StartPlayFile - kViEFileNotPlaying, // StopPlayFile. The file with the provided id is not playing. - kViEFileObserverAlreadyRegistered, // RegisterObserver - kViEFileObserverNotRegistered, // DeregisterObserver - kViEFileInputAlreadyConnected, // SendFileOnChannel- the video channel already have a connected input. - kViEFileNotConnected, // StopSendFileOnChannel- No file is being sent on the channel. - kViEFileVoEFailure, // SendFileOnChannel,StartPlayAudioLocally - failed to play audio stream - kViEFileInvalidRenderId, // SetRenderTimeoutImage and SetRenderStartImage: Renderer with the provided render id does not exist. - kViEFileInvalidFile, // Can't open the file with provided filename. Is the path and file format correct? - kViEFileInvalidCapture, // Can't use ViEPicture. Is the object correct? - kViEFileSetRenderTimeoutError, // SetRenderTimeoutImage- Please see log file. - kViEFileInvalidCaptureId, // SetCaptureDeviceImage capture id does not exist. - kViEFileSetCaptureImageError, // SetCaptureDeviceImage error. Please see log file. - kViEFileSetStartImageError, // SetRenderStartImage error. Please see log file. - kViEFileUnknownError, // An unknown error has occurred. Check the log file. + // ViENetwork. + kViENetworkInvalidChannelId = 12500, // No Channel exist with the provided channel id. + kViENetworkAlreadyReceiving, // SetLocalReceiver: Can not change ports while receiving. + kViENetworkLocalReceiverNotSet, // GetLocalReceiver: SetLocalReceiver not called. + kViENetworkAlreadySending, // SetSendDestination + kViENetworkDestinationNotSet, // GetSendDestination + kViENetworkInvalidArgument, // GetLocalIP- Check function arguments. + kViENetworkSendCodecNotSet, // SetSendGQoS- Need to set the send codec first. + kViENetworkServiceTypeNotSupported, // SetSendGQoS + kViENetworkNotSupported, // SetSendGQoS Not supported on this OS. + kViENetworkObserverAlreadyRegistered, // RegisterObserver + kViENetworkObserverNotRegistered, // SetPeriodicDeadOrAliveStatus - Need to call RegisterObserver first, DeregisterObserver if no observer is registered. + kViENetworkUnknownError, // An unknown error has occurred. Check the log file. - //ViENetwork - kViENetworkInvalidChannelId = 12500, // No Channel exist with the provided channel id. - kViENetworkAlreadyReceiving, // SetLocalReceiver: Can not change ports while receiving. - kViENetworkLocalReceiverNotSet, // GetLocalReceiver: SetLocalReceiver not called. - kViENetworkAlreadySending, // SetSendDestination - kViENetworkDestinationNotSet, // GetSendDestination - kViENetworkInvalidArgument, // GetLocalIP- Check function arguments. - kViENetworkSendCodecNotSet, // SetSendGQoS- Need to set the send codec first. - kViENetworkServiceTypeNotSupported, // SetSendGQoS - kViENetworkNotSupported, // SetSendGQoS Not supported on this OS. - kViENetworkObserverAlreadyRegistered, // RegisterObserver - kViENetworkObserverNotRegistered, // SetPeriodicDeadOrAliveStatus - Need to call RegisterObserver first, DeregisterObserver if no observer is registered. - kViENetworkUnknownError, // An unknown error has occurred. Check the log file. + // ViERTP_RTCP. + kViERtpRtcpInvalidChannelId = 12600, // No Channel exist with the provided channel id. + kViERtpRtcpAlreadySending, // The channel is already sending. Need to stop send before calling this API. + kViERtpRtcpNotSending, // The channel needs to be sending in order for this function to work. + kViERtpRtcpRtcpDisabled, // Functions failed because RTCP is disabled. + kViERtpRtcpObserverAlreadyRegistered, // An observer is already registered. Need to deregister the old first. + kViERtpRtcpObserverNotRegistered, // No observer registered. + kViERtpRtcpUnknownError, // An unknown error has occurred. Check the log file. - //ViERTP_RTCP - kViERtpRtcpInvalidChannelId = 12600, // No Channel exist with the provided channel id. - kViERtpRtcpAlreadySending, // The channel is already sending. Need to stop send before calling this API. - kViERtpRtcpNotSending, // The channel needs to be sending in order for this function to work. - kViERtpRtcpRtcpDisabled, // Functions failed because RTCP is disabled. - kViERtpRtcpObserverAlreadyRegistered, // An observer is already registered. Need to deregister the old first. - kViERtpRtcpObserverNotRegistered, // No observer registered. - kViERtpRtcpUnknownError, // An unknown error has occurred. Check the log file. + // ViEEncryption. + kViEEncryptionInvalidChannelId = 12700, // Channel id does not exist. + kViEEncryptionInvalidSrtpParameter, // EnableSRTPSend, EnableSRTPReceive- Check the SRTP parameters. + kViEEncryptionSrtpNotSupported, // This build does not support SRTP. + kViEEncryptionUnknownError, // An unknown error has occurred. Check the log file. - //ViEEncryption - kViEEncryptionInvalidChannelId = 12700, // Channel id does not exist. - kViEEncryptionInvalidSrtpParameter, // EnableSRTPSend, EnableSRTPReceive- Check the SRTP parameters. - kViEEncryptionSrtpNotSupported, // This build does not support SRTP. - kViEEncryptionUnknownError, // An unknown error has occurred. Check the log file. - - //ViEImageProcess - kViEImageProcessInvalidChannelId = 12800, // No Channel exist with the provided channel id. - kViEImageProcessInvalidCaptureId, // No capture device exist with the provided capture id. - kViEImageProcessFilterExists, // RegisterCaptureEffectFilter,RegisterSendEffectFilter,RegisterRenderEffectFilter - Effect filter already registered. - kViEImageProcessFilterDoesNotExist, // DeRegisterCaptureEffectFilter,DeRegisterSendEffectFilter,DeRegisterRenderEffectFilter - Effect filter not registered. - kViEImageProcessAlreadyEnabled, // EnableDeflickering,EnableDenoising,EnableColorEnhancement- Function already enabled. - kViEImageProcessAlreadyDisabled, // EnableDeflickering,EnableDenoising,EnableColorEnhancement- Function already disabled. - kViEImageProcessUnknownError // An unknown error has occurred. Check the log file. + // ViEImageProcess. + kViEImageProcessInvalidChannelId = 12800, // No Channel exist with the provided channel id. + kViEImageProcessInvalidCaptureId, // No capture device exist with the provided capture id. + kViEImageProcessFilterExists, // RegisterCaptureEffectFilter,RegisterSendEffectFilter,RegisterRenderEffectFilter - Effect filter already registered. + kViEImageProcessFilterDoesNotExist, // DeRegisterCaptureEffectFilter,DeRegisterSendEffectFilter,DeRegisterRenderEffectFilter - Effect filter not registered. + kViEImageProcessAlreadyEnabled, // EnableDeflickering,EnableDenoising,EnableColorEnhancement- Function already enabled. + kViEImageProcessAlreadyDisabled, // EnableDeflickering,EnableDenoising,EnableColorEnhancement- Function already disabled. + kViEImageProcessUnknownError // An unknown error has occurred. Check the log file. }; -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_ERRORS_H_ +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_ERRORS_H_ diff --git a/src/video_engine/include/vie_external_codec.h b/src/video_engine/include/vie_external_codec.h index 28e2767552..a2e686a9f6 100644 --- a/src/video_engine/include/vie_external_codec.h +++ b/src/video_engine/include/vie_external_codec.h @@ -8,47 +8,44 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_EXTERNAL_CODEC_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_EXTERNAL_CODEC_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_EXTERNAL_CODEC_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_EXTERNAL_CODEC_H_ #include "common_types.h" -namespace webrtc -{ -class VideoEngine; -class VideoEncoder; +namespace webrtc { + class VideoDecoder; +class VideoEncoder; +class VideoEngine; -// ---------------------------------------------------------------------------- -// ViEExternalCodec -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViEExternalCodec { + public: + static ViEExternalCodec* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViEExternalCodec -{ -public: - static ViEExternalCodec* GetInterface(VideoEngine* videoEngine); + virtual int Release() = 0; - virtual int Release() = 0; + virtual int RegisterExternalSendCodec(const int video_channel, + const unsigned char pl_type, + VideoEncoder* encoder) = 0; - virtual int RegisterExternalSendCodec(const int videoChannel, - const unsigned char plType, - VideoEncoder* encoder) = 0; + virtual int DeRegisterExternalSendCodec(const int video_channel, + const unsigned char pl_type) = 0; - virtual int DeRegisterExternalSendCodec(const int videoChannel, - const unsigned char plType) = 0; + virtual int RegisterExternalReceiveCodec(const int video_channel, + const unsigned int pl_type, + VideoDecoder* decoder, + bool decoder_render = false, + int render_delay = 0) = 0; - virtual int RegisterExternalReceiveCodec(const int videoChannel, - const unsigned int plType, - VideoDecoder* decoder, - bool decoderRender = false, - int renderDelay = 0) = 0; + virtual int DeRegisterExternalReceiveCodec(const int video_channel, + const unsigned char pl_type) = 0; - virtual int DeRegisterExternalReceiveCodec(const int videoChannel, - const unsigned char plType) = 0; - -protected: - ViEExternalCodec() {}; - virtual ~ViEExternalCodec() {}; + protected: + ViEExternalCodec() {} + virtual ~ViEExternalCodec() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_EXTERNAL_CODEC_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_EXTERNAL_CODEC_H_ diff --git a/src/video_engine/include/vie_file.h b/src/video_engine/include/vie_file.h index 141254b559..fbc3d2bfa2 100644 --- a/src/video_engine/include/vie_file.h +++ b/src/video_engine/include/vie_file.h @@ -13,217 +13,209 @@ // - Snapshots. // - Background images. - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_FILE_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_FILE_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_FILE_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_FILE_H_ #include "common_types.h" -namespace webrtc -{ +namespace webrtc { + class VideoEngine; struct VideoCodec; // This structure contains picture data and describes the picture type. -struct ViEPicture -{ - unsigned char* data; - unsigned int size; - unsigned int width; - unsigned int height; - RawVideoType type; +struct ViEPicture { + unsigned char* data; + unsigned int size; + unsigned int width; + unsigned int height; + RawVideoType type; - ViEPicture() - { - data = NULL; - size = 0; - width = 0; - height = 0; - type = kVideoI420; - } + ViEPicture() { + data = NULL; + size = 0; + width = 0; + height = 0; + type = kVideoI420; + } - //call FreePicture to free data - ~ViEPicture() - { - data = NULL; - size = 0; - width = 0; - height = 0; - type = kVideoUnknown; - } + // Call FreePicture to free data. + ~ViEPicture() { + data = NULL; + size = 0; + width = 0; + height = 0; + type = kVideoUnknown; + } }; // This enumerator tells which audio source to use for media files. -enum AudioSource -{ - NO_AUDIO, - MICROPHONE, - PLAYOUT, - VOICECALL +enum AudioSource { + NO_AUDIO, + MICROPHONE, + PLAYOUT, + VOICECALL }; // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterObserver() and // deregistered using DeregisterObserver(). -class WEBRTC_DLLEXPORT ViEFileObserver -{ -public: - // This method is called when the end is reached of a played file. - virtual void PlayFileEnded(const WebRtc_Word32 fileId) = 0; +class WEBRTC_DLLEXPORT ViEFileObserver { + public: + // This method is called when the end is reached of a played file. + virtual void PlayFileEnded(const WebRtc_Word32 file_id) = 0; -protected: - virtual ~ViEFileObserver() {}; + protected: + virtual ~ViEFileObserver() {} }; -// ---------------------------------------------------------------------------- -// ViEFile -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViEFile { + public: + // Factory for the ViEFile sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViEFile* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViEFile -{ -public: - // Factory for the ViEFile sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViEFile* GetInterface(VideoEngine* videoEngine); + // Releases the ViEFile sub-API and decreases an internal reference counter. + // Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViEFile sub-API and decreases an internal reference counter. - // Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Starts playing a video file. + virtual int StartPlayFile( + const char* file_name_utf8, + int& file_id, + const bool loop = false, + const FileFormats file_format = kFileFormatAviFile) = 0; - // Starts playing a video file. - virtual int StartPlayFile(const char* fileNameUTF8, int& fileId, - const bool loop = false, - const FileFormats fileFormat = - kFileFormatAviFile) = 0; + // Stops a file from being played. + virtual int StopPlayFile(const int file_id) = 0; - // Stops a file from being played. - virtual int StopPlayFile(const int fileId) = 0; + // Registers an instance of a user implementation of the ViEFileObserver. + virtual int RegisterObserver(int file_id, ViEFileObserver& observer) = 0; - // Registers an instance of a user implementation of the ViEFileObserver. - virtual int RegisterObserver(int fileId, ViEFileObserver& observer) = 0; + // Removes an already registered instance of ViEFileObserver. + virtual int DeregisterObserver(int file_id, ViEFileObserver& observer) = 0; - // Removes an already registered instance of ViEFileObserver. - virtual int DeregisterObserver(int fileId, ViEFileObserver& observer) = 0; + // This function tells which channel, if any, the file should be sent on. + virtual int SendFileOnChannel(const int file_id, const int video_channel) = 0; - // This function tells which channel, if any, the file should be sent on. - virtual int SendFileOnChannel(const int fileId, const int videoChannel) = 0; + // Stops a file from being sent on a a channel. + virtual int StopSendFileOnChannel(const int video_channel) = 0; - // Stops a file from being sent on a a channel. - virtual int StopSendFileOnChannel(const int videoChannel) = 0; + // Starts playing the file audio as microphone input for the specified voice + // channel. + virtual int StartPlayFileAsMicrophone(const int file_id, + const int audio_channel, + bool mix_microphone = false, + float volume_scaling = 1) = 0; - // Starts playing the file audio as microphone input for the specified voice - // channel. - virtual int StartPlayFileAsMicrophone(const int fileId, - const int audioChannel, - bool mixMicrophone = false, - float volumeScaling = 1) = 0; + // The function stop the audio from being played on a VoiceEngine channel. + virtual int StopPlayFileAsMicrophone(const int file_id, + const int audio_channel) = 0; - // The function stop the audio from being played on a VoiceEngine channel. - virtual int StopPlayFileAsMicrophone(const int fileId, - const int audioChannel) = 0; + // The function plays and mixes the file audio with the local speaker signal + // for playout. + virtual int StartPlayAudioLocally(const int file_id, const int audio_channel, + float volume_scaling = 1) = 0; - // The function plays and mixes the file audio with the local speaker signal - // for playout. - virtual int StartPlayAudioLocally(const int fileId, const int audioChannel, - float volumeScaling = 1) = 0; + // Stops the audio from a file from being played locally. + virtual int StopPlayAudioLocally(const int file_id, + const int audio_channel) = 0; - // Stops the audio from a file from being played locally. - virtual int StopPlayAudioLocally(const int fileId, - const int audioChannel) = 0; + // This function starts recording the video transmitted to another endpoint. + virtual int StartRecordOutgoingVideo( + const int video_channel, + const char* file_name_utf8, + AudioSource audio_source, + const CodecInst& audio_codec, + const VideoCodec& video_codec, + const FileFormats file_format = kFileFormatAviFile) = 0; - // This function starts recording the video transmitted to another endpoint. - virtual int StartRecordOutgoingVideo(const int videoChannel, - const char* fileNameUTF8, - AudioSource audioSource, - const CodecInst& audioCodec, - const VideoCodec& videoCodec, - const FileFormats fileFormat = - kFileFormatAviFile) =0; + // This function starts recording the incoming video stream on a channel. + virtual int StartRecordIncomingVideo( + const int video_channel, + const char* file_name_utf8, + AudioSource audio_source, + const CodecInst& audio_codec, + const VideoCodec& video_codec, + const FileFormats file_format = kFileFormatAviFile) = 0; - // This function starts recording the incoming video stream on a channel. - virtual int StartRecordIncomingVideo(const int videoChannel, - const char* fileNameUTF8, - AudioSource audioSource, - const CodecInst& audioCodec, - const VideoCodec& videoCodec, - const FileFormats fileFormat = - kFileFormatAviFile) = 0; + // Stops the file recording of the outgoing stream. + virtual int StopRecordOutgoingVideo(const int video_channel) = 0; - // Stops the file recording of the outgoing stream. - virtual int StopRecordOutgoingVideo(const int videoChannel) = 0; + // Stops the file recording of the incoming stream. + virtual int StopRecordIncomingVideo(const int video_channel) = 0; - // Stops the file recording of the incoming stream. - virtual int StopRecordIncomingVideo(const int videoChannel) = 0; + // Gets the audio codec, video codec and file format of a recorded file. + virtual int GetFileInformation( + const char* file_name, + VideoCodec& video_codec, + CodecInst& audio_codec, + const FileFormats file_format = kFileFormatAviFile) = 0; - // Gets the audio codec, video codec and file format of a recorded file. - virtual int GetFileInformation(const char* fileName, - VideoCodec& videoCodec, - CodecInst& audioCodec, - const FileFormats fileFormat = - kFileFormatAviFile) = 0; + // The function takes a snapshot of the last rendered image for a video + // channel. + virtual int GetRenderSnapshot(const int video_channel, + const char* file_name_utf8) = 0; - // The function takes a snapshot of the last rendered image for a video - // channel. - virtual int GetRenderSnapshot(const int videoChannel, - const char* fileNameUTF8) = 0; + // The function takes a snapshot of the last rendered image for a video + // channel + virtual int GetRenderSnapshot(const int video_channel, + ViEPicture& picture) = 0; - // The function takes a snapshot of the last rendered image for a video - // channel - virtual int GetRenderSnapshot(const int videoChannel, - ViEPicture& picture) = 0; + // The function takes a snapshot of the last captured image by a specified + // capture device. + virtual int GetCaptureDeviceSnapshot(const int capture_id, + const char* file_name_utf8) = 0; - // The function takes a snapshot of the last captured image by a specified - // capture device. - virtual int GetCaptureDeviceSnapshot(const int captureId, - const char* fileNameUTF8) = 0; + // The function takes a snapshot of the last captured image by a specified + // capture device. + virtual int GetCaptureDeviceSnapshot(const int capture_id, + ViEPicture& picture) = 0; - // The function takes a snapshot of the last captured image by a specified - // capture device. - virtual int GetCaptureDeviceSnapshot(const int captureId, - ViEPicture& picture) = 0; + // This function sets a jpg image to show before the first frame is captured + // by the capture device. This frame will be encoded and transmitted to a + // possible receiver + virtual int SetCaptureDeviceImage(const int capture_id, + const char* file_name_utf8) = 0; - // This function sets a jpg image to show before the first frame is captured - // by the capture device. This frame will be encoded and transmitted to a - // possible receiver - virtual int SetCaptureDeviceImage(const int captureId, - const char* fileNameUTF8) = 0; - - // This function sets an image to show before the first frame is captured by - // the capture device. This frame will be encoded and transmitted to a - // possible receiver - virtual int SetCaptureDeviceImage(const int captureId, - const ViEPicture& picture) = 0; - - virtual int FreePicture(ViEPicture& picture) = 0; - - // This function sets a jpg image to render before the first received video - // frame is decoded for a specified channel. - virtual int SetRenderStartImage(const int videoChannel, - const char* fileNameUTF8) = 0; - - // This function sets an image to render before the first received video - // frame is decoded for a specified channel. - virtual int SetRenderStartImage(const int videoChannel, + // This function sets an image to show before the first frame is captured by + // the capture device. This frame will be encoded and transmitted to a + // possible receiver + virtual int SetCaptureDeviceImage(const int capture_id, const ViEPicture& picture) = 0; - // This function sets a jpg image to render if no frame is decoded for a - // specified time interval. - virtual int SetRenderTimeoutImage(const int videoChannel, - const char* fileNameUTF8, - const unsigned int timeoutMs = 1000) = 0; + virtual int FreePicture(ViEPicture& picture) = 0; - // This function sets an image to render if no frame is decoded for a - // specified time interval. - virtual int SetRenderTimeoutImage(const int videoChannel, - const ViEPicture& picture, - const unsigned int timeoutMs) = 0; + // This function sets a jpg image to render before the first received video + // frame is decoded for a specified channel. + virtual int SetRenderStartImage(const int video_channel, + const char* file_name_utf8) = 0; -protected: - ViEFile() {}; - virtual ~ViEFile() {}; + // This function sets an image to render before the first received video + // frame is decoded for a specified channel. + virtual int SetRenderStartImage(const int video_channel, + const ViEPicture& picture) = 0; + + // This function sets a jpg image to render if no frame is decoded for a + // specified time interval. + virtual int SetRenderTimeoutImage(const int video_channel, + const char* file_name_utf8, + const unsigned int timeout_ms = 1000) = 0; + + // This function sets an image to render if no frame is decoded for a + // specified time interval. + virtual int SetRenderTimeoutImage(const int video_channel, + const ViEPicture& picture, + const unsigned int timeout_ms) = 0; + + protected: + ViEFile() {} + virtual ~ViEFile() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_FILE_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_FILE_H_ diff --git a/src/video_engine/include/vie_image_process.h b/src/video_engine/include/vie_image_process.h index c1b79deca4..dfad08d8a4 100644 --- a/src/video_engine/include/vie_image_process.h +++ b/src/video_engine/include/vie_image_process.h @@ -14,95 +14,88 @@ // - Denoising // - Color enhancement - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_IMAGE_PROCESS_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_IMAGE_PROCESS_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_ #include "common_types.h" -namespace webrtc -{ -class VideoEngine; +namespace webrtc { -// ---------------------------------------------------------------------------- -// ViEEffectFilter -// ---------------------------------------------------------------------------- +class VideoEngine; // This class declares an abstract interface for a user defined effect filter. // The effect filter is registered using RegisterCaptureEffectFilter(), // RegisterSendEffectFilter() or RegisterRenderEffectFilter() and deregistered // with the corresponding deregister function. -class WEBRTC_DLLEXPORT ViEEffectFilter -{ -public: - // This method is called with an I420 video frame allowing the user to - // modify the video frame. - virtual int Transform(int size, unsigned char* frameBuffer, - unsigned int timeStamp90KHz, unsigned int width, - unsigned int height) = 0; -protected: - ViEEffectFilter() {} - virtual ~ViEEffectFilter(){} +class WEBRTC_DLLEXPORT ViEEffectFilter { + public: + // This method is called with an I420 video frame allowing the user to + // modify the video frame. + virtual int Transform(int size, + unsigned char* frame_buffer, + unsigned int time_stamp90KHz, + unsigned int width, + unsigned int height) = 0; + protected: + ViEEffectFilter() {} + virtual ~ViEEffectFilter() {} }; -// ---------------------------------------------------------------------------- -// ViEImageProcess -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViEImageProcess { + public: + // Factory for the ViEImageProcess sub‐API and increases an internal + // reference counter if successful. Returns NULL if the API is not supported + // or if construction fails. + static ViEImageProcess* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViEImageProcess -{ -public: - // Factory for the ViEImageProcess sub‐API and increases an internal - // reference counter if successful. Returns NULL if the API is not supported - // or if construction fails. - static ViEImageProcess* GetInterface(VideoEngine* videoEngine); + // Releases the ViEImageProcess sub-API and decreases an internal reference + // counter. Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViEImageProcess sub-API and decreases an internal reference - // counter. Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // This function registers a EffectFilter to use for a specified capture + // device. + virtual int RegisterCaptureEffectFilter(const int capture_id, + ViEEffectFilter& capture_filter) = 0; - // This function registers a EffectFilter to use for a specified capture - // device. - virtual int RegisterCaptureEffectFilter(const int captureId, - ViEEffectFilter& captureFilter) = 0; + // This function deregisters a EffectFilter for a specified capture device. + virtual int DeregisterCaptureEffectFilter(const int capture_id) = 0; - // This function deregisters a EffectFilter for a specified capture device. - virtual int DeregisterCaptureEffectFilter(const int captureId) = 0; + // This function registers an EffectFilter to use for a specified channel. + virtual int RegisterSendEffectFilter(const int video_channel, + ViEEffectFilter& send_filter) = 0; - // This function registers an EffectFilter to use for a specified channel. - virtual int RegisterSendEffectFilter(const int videoChannel, - ViEEffectFilter& sendFilter) = 0; + // This function deregisters a send effect filter for a specified channel. + virtual int DeregisterSendEffectFilter(const int video_channel) = 0; - // This function deregisters a send effect filter for a specified channel. - virtual int DeregisterSendEffectFilter(const int videoChannel) = 0; + // This function registers a EffectFilter to use for the rendered video + // stream on an incoming channel. + virtual int RegisterRenderEffectFilter(const int video_channel, + ViEEffectFilter& render_filter) = 0; - // This function registers a EffectFilter to use for the rendered video - // stream on an incoming channel. - virtual int RegisterRenderEffectFilter(const int videoChannel, - ViEEffectFilter& renderFilter) = 0; + // This function deregisters a render effect filter for a specified channel. + virtual int DeregisterRenderEffectFilter(const int video_channel) = 0; - // This function deregisters a render effect filter for a specified channel. - virtual int DeregisterRenderEffectFilter(const int videoChannel) = 0; + // All cameras run the risk of getting in almost perfect sync with + // florescent lamps, which will result in a very annoying flickering of the + // image. Most cameras have some type of filter to protect against this but + // not all of them succeed. Enabling this function will remove the flicker. + virtual int EnableDeflickering(const int capture_id, const bool enable) = 0; - // All cameras run the risk of getting in almost perfect sync with - // florescent lamps, which will result in a very annoying flickering of the - // image. Most cameras have some type of filter to protect against this but - // not all of them succeed. Enabling this function will remove the flicker. - virtual int EnableDeflickering(const int captureId, const bool enable) = 0; + // Some cameras produce very noisy captured images, especially in low‐light + // conditions. This functionality will reduce the camera noise. + virtual int EnableDenoising(const int capture_id, const bool enable) = 0; - // Some cameras produce very noisy captured images, especially in low‐light - // conditions. This functionality will reduce the camera noise. - virtual int EnableDenoising(const int captureId, const bool enable) = 0; + // This function enhances the colors on the decoded video stream, enabled by + // default. + virtual int EnableColorEnhancement(const int video_channel, + const bool enable) = 0; - // This function enhances the colors on the decoded video stream, enabled by - // default. - virtual int EnableColorEnhancement(const int videoChannel, - const bool enable) = 0; - -protected: - ViEImageProcess() {}; - virtual ~ViEImageProcess() {}; + protected: + ViEImageProcess() {} + virtual ~ViEImageProcess() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_IMAGE_PROCESS_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_ diff --git a/src/video_engine/include/vie_network.h b/src/video_engine/include/vie_network.h index aa97053e5c..9752008d93 100644 --- a/src/video_engine/include/vie_network.h +++ b/src/video_engine/include/vie_network.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_NETWORK_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_NETWORK_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_ // This sub-API supports the following functionalities: // - Configuring send and receive addresses. @@ -19,196 +19,197 @@ // - Packet timeout notification. // - Dead‐or‐Alive connection observations. - #include "common_types.h" -namespace webrtc -{ -class VideoEngine; -class Transport; +namespace webrtc { -// ---------------------------------------------------------------------------- -// ViENetworkObserver -// ---------------------------------------------------------------------------- +class Transport; +class VideoEngine; // This enumerator describes VideoEngine packet timeout states. -enum ViEPacketTimeout -{ - NoPacket = 0, - PacketReceived = 1 +enum ViEPacketTimeout { + NoPacket = 0, + PacketReceived = 1 }; // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterObserver() and // deregistered using DeregisterObserver(). -class WEBRTC_DLLEXPORT ViENetworkObserver -{ -public: - // This method will be called periodically delivering a dead‐or‐alive - // decision for a specified channel. - virtual void OnPeriodicDeadOrAlive(const int videoChannel, - const bool alive) = 0; +class WEBRTC_DLLEXPORT ViENetworkObserver { + public: + // This method will be called periodically delivering a dead‐or‐alive + // decision for a specified channel. + virtual void OnPeriodicDeadOrAlive(const int video_channel, + const bool alive) = 0; - // This method is called once if a packet timeout occurred. - virtual void PacketTimeout(const int videoChannel, - const ViEPacketTimeout timeout) = 0; -protected: - virtual ~ViENetworkObserver() {}; + // This method is called once if a packet timeout occurred. + virtual void PacketTimeout(const int video_channel, + const ViEPacketTimeout timeout) = 0; + protected: + virtual ~ViENetworkObserver() {} }; -// ---------------------------------------------------------------------------- -// ViENetwork -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViENetwork { + public: + // Default values. + enum { KDefaultSampleTimeSeconds = 2 }; -class WEBRTC_DLLEXPORT ViENetwork -{ -public: - // Default values - enum - { - KDefaultSampleTimeSeconds = 2 - }; + // Factory for the ViENetwork sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViENetwork* GetInterface(VideoEngine* video_engine); - // Factory for the ViENetwork sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViENetwork* GetInterface(VideoEngine* videoEngine); + // Releases the ViENetwork sub-API and decreases an internal reference + // counter.Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViENetwork sub-API and decreases an internal reference - // counter.Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Specifies the ports to receive RTP packets on. It is also possible to set + // port for RTCP and local IP address. + virtual int SetLocalReceiver(const int video_channel, + const unsigned short rtp_port, + const unsigned short rtcp_port = 0, + const char* ip_address = NULL) = 0; - // Specifies the ports to receive RTP packets on. It is also possible to set - // port for RTCP and local IP address. - virtual int SetLocalReceiver(const int videoChannel, - const unsigned short rtpPort, - const unsigned short rtcpPort = 0, - const char* ipAddress = NULL) = 0; + // Gets the local receiver ports and address for a specified channel. + virtual int GetLocalReceiver(const int video_channel, + unsigned short& rtp_port, + unsigned short& rtcp_port, char* ip_address) = 0; - // Gets the local receiver ports and address for a specified channel. - virtual int GetLocalReceiver(const int videoChannel, - unsigned short& rtpPort, - unsigned short& rtcpPort, char* ipAddress) = 0; + // Specifies the destination port and IP address for a specified channel. + virtual int SetSendDestination(const int video_channel, + const char* ip_address, + const unsigned short rtp_port, + const unsigned short rtcp_port = 0, + const unsigned short source_rtp_port = 0, + const unsigned short source_rtcp_port = 0) = 0; - // Specifies the destination port and IP address for a specified channel. - virtual int SetSendDestination(const int videoChannel, - const char* ipAddress, - const unsigned short rtpPort, - const unsigned short rtcpPort = 0, - const unsigned short sourceRtpPort = 0, - const unsigned short sourceRtcpPort = 0) = 0; + // Get the destination port and address for a specified channel. + virtual int GetSendDestination(const int video_channel, + char* ip_address, + unsigned short& rtp_port, + unsigned short& rtcp_port, + unsigned short& source_rtp_port, + unsigned short& source_rtcp_port) = 0; - // Get the destination port and address for a specified channel. - virtual int GetSendDestination(const int videoChannel, char* ipAddress, - unsigned short& rtpPort, - unsigned short& rtcpPort, - unsigned short& sourceRtpPort, - unsigned short& sourceRtcpPort) = 0; + // This function registers a user implementation of Transport to use for + // sending RTP and RTCP packets on this channel. + virtual int RegisterSendTransport(const int video_channel, + Transport& transport) = 0; - // This function registers a user implementation of Transport to use for - // sending RTP and RTCP packets on this channel. - virtual int RegisterSendTransport(const int videoChannel, - Transport& transport) = 0; + // This function deregisters a used Transport for a specified channel. + virtual int DeregisterSendTransport(const int video_channel) = 0; - // This function deregisters a used Transport for a specified channel. - virtual int DeregisterSendTransport(const int videoChannel) = 0; + // When using external transport for a channel, received RTP packets should + // be passed to VideoEngine using this function. The input should contain + // the RTP header and payload. + virtual int ReceivedRTPPacket(const int video_channel, + const void* data, + const int length) = 0; - // When using external transport for a channel, received RTP packets should - // be passed to VideoEngine using this function. The input should contain - // the RTP header and payload. - virtual int ReceivedRTPPacket(const int videoChannel, const void* data, - const int length) = 0; + // When using external transport for a channel, received RTCP packets should + // be passed to VideoEngine using this function. + virtual int ReceivedRTCPPacket(const int video_channel, + const void* data, + const int length) = 0; - // When using external transport for a channel, received RTCP packets should - // be passed to VideoEngine using this function. - virtual int ReceivedRTCPPacket(const int videoChannel, const void* data, - const int length) = 0; + // Gets the source ports and IP address of the incoming stream for a + // specified channel. + virtual int GetSourceInfo(const int video_channel, + unsigned short& rtp_port, + unsigned short& rtcp_port, + char* ip_address, + unsigned int ip_address_length) = 0; - // Gets the source ports and IP address of the incoming stream for a - // specified channel. - virtual int GetSourceInfo(const int videoChannel, unsigned short& rtpPort, - unsigned short& rtcpPort, char* ipAddress, - unsigned int ipAddressLength) = 0; + // Gets the local IP address, in string format. + virtual int GetLocalIP(char ip_address[64], bool ipv6 = false) = 0; - // Gets the local IP address, in string format. - virtual int GetLocalIP(char ipAddress[64], bool ipv6 = false) = 0; + // Enables IPv6, instead of IPv4, for a specified channel. + virtual int EnableIPv6(int video_channel) = 0; - // Enables IPv6, instead of IPv4, for a specified channel. - virtual int EnableIPv6(int videoChannel) = 0; + // The function returns true if IPv6 is enabled, false otherwise. + virtual bool IsIPv6Enabled(int video_channel) = 0; - // The function returns true if IPv6 is enabled, false otherwise. - virtual bool IsIPv6Enabled(int videoChannel) = 0; + // Enables a port and IP address filtering for incoming packets on a + // specific channel. + virtual int SetSourceFilter(const int video_channel, + const unsigned short rtp_port, + const unsigned short rtcp_port = 0, + const char* ip_address = NULL) = 0; - // Enables a port and IP address filtering for incoming packets on a - // specific channel. - virtual int SetSourceFilter(const int videoChannel, - const unsigned short rtpPort, - const unsigned short rtcpPort = 0, - const char* ipAddress = NULL) = 0; + // Gets current port and IP address filter for a specified channel. + virtual int GetSourceFilter(const int video_channel, + unsigned short& rtp_port, + unsigned short& rtcp_port, + char* ip_address) = 0; - // Gets current port and IP address filter for a specified channel. - virtual int GetSourceFilter(const int videoChannel, unsigned short& rtpPort, - unsigned short& rtcpPort, char* ipAddress) = 0; + // This function sets the six‐bit Differentiated Services Code Point (DSCP) + // in the IP header of the outgoing stream for a specific channel. + // Windows and Linux only. + virtual int SetSendToS(const int video_channel, + const int DSCP, + const bool use_set_sockOpt = false) = 0; - // This function sets the six‐bit Differentiated Services Code Point (DSCP) - // in the IP header of the outgoing stream for a specific channel. - // Windows and Linux only. - virtual int SetSendToS(const int videoChannel, const int DSCP, - const bool useSetSockOpt = false) = 0; + // Retrieves the six‐bit Differentiated Services Code Point (DSCP) in the IP + // header of the outgoing stream for a specific channel. + virtual int GetSendToS(const int video_channel, + int& DSCP, + bool& use_set_sockOpt) = 0; - // Retrieves the six‐bit Differentiated Services Code Point (DSCP) in the IP - // header of the outgoing stream for a specific channel. - virtual int GetSendToS(const int videoChannel, int& DSCP, - bool& useSetSockOpt) = 0; + // This function sets the Generic Quality of Service (GQoS) service level. + // The Windows operating system then maps to a Differentiated Services Code + // Point (DSCP) and to an 802.1p setting. Windows only. + virtual int SetSendGQoS(const int video_channel, const bool enable, + const int service_type, + const int overrideDSCP = 0) = 0; - // This function sets the Generic Quality of Service (GQoS) service level. - // The Windows operating system then maps to a Differentiated Services Code - // Point (DSCP) and to an 802.1p setting. Windows only. - virtual int SetSendGQoS(const int videoChannel, const bool enable, - const int serviceType, - const int overrideDSCP = 0) = 0; + // This function retrieves the currently set GQoS service level for a + // specific channel. + virtual int GetSendGQoS(const int video_channel, + bool& enabled, + int& service_type, + int& overrideDSCP) = 0; - // This function retrieves the currently set GQoS service level for a - // specific channel. - virtual int GetSendGQoS(const int videoChannel, bool& enabled, - int& serviceType, int& overrideDSCP) = 0; + // This function sets the Maximum Transition Unit (MTU) for a channel. The + // RTP packet will be packetized based on this MTU to optimize performance + // over the network. + virtual int SetMTU(int video_channel, unsigned int mtu) = 0; - // This function sets the Maximum Transition Unit (MTU) for a channel. The - // RTP packet will be packetized based on this MTU to optimize performance - // over the network. - virtual int SetMTU(int videoChannel, unsigned int mtu) = 0; + // This function enables or disables warning reports if packets have not + // been received for a specified time interval. + virtual int SetPacketTimeoutNotification(const int video_channel, + bool enable, + int timeout_seconds) = 0; - // This function enables or disables warning reports if packets have not - // been received for a specified time interval. - virtual int SetPacketTimeoutNotification(const int videoChannel, - bool enable, - int timeoutSeconds) = 0; + // Registers an instance of a user implementation of the ViENetwork + // observer. + virtual int RegisterObserver(const int video_channel, + ViENetworkObserver& observer) = 0; - // Registers an instance of a user implementation of the ViENetwork - // observer. - virtual int RegisterObserver(const int videoChannel, - ViENetworkObserver& observer) = 0; + // Removes a registered instance of ViENetworkObserver. + virtual int DeregisterObserver(const int video_channel) = 0; - // Removes a registered instance of ViENetworkObserver. - virtual int DeregisterObserver(const int videoChannel) = 0; + // This function enables or disables the periodic dead‐or‐alive callback + // functionality for a specified channel. + virtual int SetPeriodicDeadOrAliveStatus( + const int video_channel, + const bool enable, + const unsigned int sample_time_seconds = KDefaultSampleTimeSeconds) = 0; - // This function enables or disables the periodic dead‐or‐alive callback - // functionality for a specified channel. - virtual int SetPeriodicDeadOrAliveStatus( - const int videoChannel, const bool enable, - const unsigned int sampleTimeSeconds = KDefaultSampleTimeSeconds) = 0; + // This function handles sending a raw UDP data packet over an existing RTP + // or RTCP socket. + virtual int SendUDPPacket(const int video_channel, + const void* data, + const unsigned int length, + int& transmitted_bytes, + bool use_rtcp_socket = false) = 0; - // This function handles sending a raw UDP data packet over an existing RTP - // or RTCP socket. - virtual int SendUDPPacket(const int videoChannel, const void* data, - const unsigned int length, int& transmittedBytes, - bool useRtcpSocket = false) = 0; - -protected: - ViENetwork() {}; - virtual ~ViENetwork() {}; + protected: + ViENetwork() {} + virtual ~ViENetwork() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_NETWORK_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_ diff --git a/src/video_engine/include/vie_render.h b/src/video_engine/include/vie_render.h index fdeae7fb62..872ce23bd6 100644 --- a/src/video_engine/include/vie_render.h +++ b/src/video_engine/include/vie_render.h @@ -13,95 +13,95 @@ // and files. // - Configuring render streams. - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RENDER_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RENDER_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RENDER_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RENDER_H_ #include "common_types.h" -namespace webrtc -{ +namespace webrtc { -class VideoRender; class VideoEngine; - -// ---------------------------------------------------------------------------- -// ExternalRenderer -// ---------------------------------------------------------------------------- +class VideoRender; // This class declares an abstract interface to be used for external renderers. // The user implemented derived class is registered using AddRenderer(). -class WEBRTC_DLLEXPORT ExternalRenderer -{ -public: - // This method will be called when the stream to be rendered changes in - // resolution or number of streams mixed in the image. - virtual int FrameSizeChange(unsigned int width, unsigned int height, - unsigned int numberOfStreams) = 0; +class WEBRTC_DLLEXPORT ExternalRenderer { + public: + // This method will be called when the stream to be rendered changes in + // resolution or number of streams mixed in the image. + virtual int FrameSizeChange(unsigned int width, + unsigned int height, + unsigned int number_of_streams) = 0; - // This method is called when a new frame should be rendered. - virtual int DeliverFrame(unsigned char* buffer, int bufferSize, - unsigned int time_stamp) = 0; + // This method is called when a new frame should be rendered. + virtual int DeliverFrame(unsigned char* buffer, + int buffer_size, + unsigned int time_stamp) = 0; -protected: - virtual ~ExternalRenderer() {} + protected: + virtual ~ExternalRenderer() {} }; -// ---------------------------------------------------------------------------- -// ViERender -// ---------------------------------------------------------------------------- +class WEBRTC_DLLEXPORT ViERender { + public: + // Factory for the ViERender sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViERender* GetInterface(VideoEngine* video_engine); -class WEBRTC_DLLEXPORT ViERender -{ -public: - // Factory for the ViERender sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViERender* GetInterface(VideoEngine* videoEngine); + // Releases the ViERender sub-API and decreases an internal reference + // counter. Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // Releases the ViERender sub-API and decreases an internal reference - // counter. Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Registers render module. + virtual int RegisterVideoRenderModule(VideoRender& render_module) = 0; - // Registers render module - virtual int RegisterVideoRenderModule(VideoRender& renderModule) = 0; + // Deregisters render module. + virtual int DeRegisterVideoRenderModule(VideoRender& render_module) = 0; - // Deegisters render module - virtual int DeRegisterVideoRenderModule(VideoRender& renderModule) = 0; + // Sets the render destination for a given render ID. + virtual int AddRenderer(const int render_id, + void* window, + const unsigned int z_order, + const float left, + const float top, + const float right, + const float bottom) = 0; - // Sets the render destination for a given render ID. - virtual int AddRenderer(const int renderId, void* window, - const unsigned int zOrder, const float left, - const float top, const float right, - const float bottom) = 0; + // Removes the renderer for a stream. + virtual int RemoveRenderer(const int render_id) = 0; - // Removes the renderer for a stream - virtual int RemoveRenderer(const int renderId) = 0; + // Starts rendering a render stream. + virtual int StartRender(const int render_id) = 0; - // Starts rendering a render stream. - virtual int StartRender(const int renderId) = 0; + // Stops rendering a render stream. + virtual int StopRender(const int render_id) = 0; - // Stops rendering a render stream. - virtual int StopRender(const int renderId) = 0; + // Configures an already added render stream. + virtual int ConfigureRender(int render_id, + const unsigned int z_order, + const float left, + const float top, + const float right, + const float bottom) = 0; - // Configures an already added render stream. - virtual int ConfigureRender(int renderId, const unsigned int zOrder, - const float left, const float top, - const float right, const float bottom) = 0; + // This function mirrors the rendered stream left and right or up and down. + virtual int MirrorRenderStream(const int render_id, + const bool enable, + const bool mirror_xaxis, + const bool mirror_yaxis) = 0; - // This function mirrors the rendered stream left and right or up and down. - virtual int MirrorRenderStream(const int renderId, const bool enable, - const bool mirrorXAxis, - const bool mirrorYAxis) = 0; + // External render. + virtual int AddRenderer(const int render_id, + RawVideoType video_input_format, + ExternalRenderer* renderer) = 0; - // External render - virtual int AddRenderer(const int renderId, RawVideoType videoInputFormat, - ExternalRenderer* renderer) = 0; - -protected: - ViERender() {}; - virtual ~ViERender() {}; + protected: + ViERender() {} + virtual ~ViERender() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RENDER_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RENDER_H_ diff --git a/src/video_engine/include/vie_rtp_rtcp.h b/src/video_engine/include/vie_rtp_rtcp.h index 1a4253797d..bf73bda924 100644 --- a/src/video_engine/include/vie_rtp_rtcp.h +++ b/src/video_engine/include/vie_rtp_rtcp.h @@ -20,284 +20,277 @@ // call quality. // - Inserting extra RTP packets into active audio stream. - -#ifndef WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RTP_RTCP_H_ -#define WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RTP_RTCP_H_ +#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RTP_RTCP_H_ +#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RTP_RTCP_H_ #include "common_types.h" -namespace webrtc -{ +namespace webrtc { + class VideoEngine; // This enumerator sets the RTCP mode. -enum ViERTCPMode -{ - kRtcpNone = 0, - kRtcpCompound_RFC4585 = 1, - kRtcpNonCompound_RFC5506 = 2 +enum ViERTCPMode { + kRtcpNone = 0, + kRtcpCompound_RFC4585 = 1, + kRtcpNonCompound_RFC5506 = 2 }; // This enumerator describes the key frame request mode. -enum ViEKeyFrameRequestMethod -{ - kViEKeyFrameRequestNone = 0, - kViEKeyFrameRequestPliRtcp = 1, - kViEKeyFrameRequestFirRtp = 2, - kViEKeyFrameRequestFirRtcp = 3 +enum ViEKeyFrameRequestMethod { + kViEKeyFrameRequestNone = 0, + kViEKeyFrameRequestPliRtcp = 1, + kViEKeyFrameRequestFirRtp = 2, + kViEKeyFrameRequestFirRtcp = 3 }; -enum StreamType -{ - kViEStreamTypeNormal = 0, // Normal media stream - kViEStreamTypeRtx = 1 // Retransmission media stream +enum StreamType { + kViEStreamTypeNormal = 0, // Normal media stream + kViEStreamTypeRtx = 1 // Retransmission media stream }; -// ---------------------------------------------------------------------------- -// ViERTPObserver -// ---------------------------------------------------------------------------- - // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterRTPObserver() and // deregistered using DeregisterRTPObserver(). -class WEBRTC_DLLEXPORT ViERTPObserver -{ -public: - // This method is called if SSRC of the incoming stream is changed. - virtual void IncomingSSRCChanged(const int videoChannel, - const unsigned int SSRC) = 0; +class WEBRTC_DLLEXPORT ViERTPObserver { + public: + // This method is called if SSRC of the incoming stream is changed. + virtual void IncomingSSRCChanged(const int video_channel, + const unsigned int SSRC) = 0; - // This method is called if a field in CSRC changes or if the number of - // CSRCs changes. - virtual void IncomingCSRCChanged(const int videoChannel, - const unsigned int CSRC, - const bool added) = 0; -protected: - virtual ~ViERTPObserver() {} + // This method is called if a field in CSRC changes or if the number of + // CSRCs changes. + virtual void IncomingCSRCChanged(const int video_channel, + const unsigned int CSRC, + const bool added) = 0; + protected: + virtual ~ViERTPObserver() {} }; -// ---------------------------------------------------------------------------- -// ViERTCPObserver -// ---------------------------------------------------------------------------- - // This class declares an abstract interface for a user defined observer. It is // up to the VideoEngine user to implement a derived class which implements the // observer class. The observer is registered using RegisterRTCPObserver() and // deregistered using DeregisterRTCPObserver(). -class WEBRTC_DLLEXPORT ViERTCPObserver -{ -public: - // This method is called if a application-defined RTCP packet has been - // received. - virtual void OnApplicationDataReceived( - const int videoChannel, const unsigned char subType, - const unsigned int name, const char* data, - const unsigned short dataLengthInBytes) = 0; -protected: - virtual ~ViERTCPObserver() {} +class WEBRTC_DLLEXPORT ViERTCPObserver { + public: + // This method is called if a application-defined RTCP packet has been + // received. + virtual void OnApplicationDataReceived( + const int video_channel, + const unsigned char sub_type, + const unsigned int name, + const char* data, + const unsigned short data_length_in_bytes) = 0; + protected: + virtual ~ViERTCPObserver() {} }; -// -class WEBRTC_DLLEXPORT ViERTP_RTCP -{ -public: - // Default values - enum - { - KDefaultDeltaTransmitTimeSeconds = 15 - }; - enum - { - KMaxRTCPCNameLength = 256 - }; +class WEBRTC_DLLEXPORT ViERTP_RTCP { + public: + enum { KDefaultDeltaTransmitTimeSeconds = 15 }; + enum { KMaxRTCPCNameLength = 256 }; - // Factory for the ViERTP_RTCP sub‐API and increases an internal reference - // counter if successful. Returns NULL if the API is not supported or if - // construction fails. - static ViERTP_RTCP* GetInterface(VideoEngine* videoEngine); + // Factory for the ViERTP_RTCP sub‐API and increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static ViERTP_RTCP* GetInterface(VideoEngine* video_engine); - // Releases the ViERTP_RTCP sub-API and decreases an internal reference - // counter. Returns the new reference count. This value should be zero - // for all sub-API:s before the VideoEngine object can be safely deleted. - virtual int Release() = 0; + // Releases the ViERTP_RTCP sub-API and decreases an internal reference + // counter. Returns the new reference count. This value should be zero + // for all sub-API:s before the VideoEngine object can be safely deleted. + virtual int Release() = 0; - // This function enables you to specify the RTP synchronization source - // identifier (SSRC) explicitly. - virtual int SetLocalSSRC(const int videoChannel, - const unsigned int SSRC, - const StreamType usage = kViEStreamTypeNormal, - const unsigned char simulcastIdx = 0) = 0; + // This function enables you to specify the RTP synchronization source + // identifier (SSRC) explicitly. + virtual int SetLocalSSRC(const int video_channel, + const unsigned int SSRC, + const StreamType usage = kViEStreamTypeNormal, + const unsigned char simulcast_idx = 0) = 0; - // This function gets the SSRC for the outgoing RTP stream for the specified - // channel. - virtual int GetLocalSSRC(const int videoChannel, - unsigned int& SSRC) const = 0; + // This function gets the SSRC for the outgoing RTP stream for the specified + // channel. + virtual int GetLocalSSRC(const int video_channel, + unsigned int& SSRC) const = 0; - // This function map a incoming SSRC to a StreamType so that the engine - // can know which is the normal stream and which is the RTX - virtual int SetRemoteSSRCType(const int videoChannel, - const StreamType usage, - const unsigned int SSRC) const = 0; + // This function map a incoming SSRC to a StreamType so that the engine + // can know which is the normal stream and which is the RTX + virtual int SetRemoteSSRCType(const int video_channel, + const StreamType usage, + const unsigned int SSRC) const = 0; - // This function gets the SSRC for the incoming RTP stream for the specified - // channel. - virtual int GetRemoteSSRC(const int videoChannel, - unsigned int& SSRC) const = 0; + // This function gets the SSRC for the incoming RTP stream for the specified + // channel. + virtual int GetRemoteSSRC(const int video_channel, + unsigned int& SSRC) const = 0; - // This function returns the CSRCs of the incoming RTP packets. - virtual int GetRemoteCSRCs(const int videoChannel, - unsigned int CSRCs[kRtpCsrcSize]) const = 0; + // This function returns the CSRCs of the incoming RTP packets. + virtual int GetRemoteCSRCs(const int video_channel, + unsigned int CSRCs[kRtpCsrcSize]) const = 0; - // This function enables manual initialization of the sequence number. The - // start sequence number is normally a random number. - virtual int SetStartSequenceNumber(const int videoChannel, - unsigned short sequenceNumber) = 0; + // This function enables manual initialization of the sequence number. The + // start sequence number is normally a random number. + virtual int SetStartSequenceNumber(const int video_channel, + unsigned short sequence_number) = 0; - // This function sets the RTCP status for the specified channel. - // Default mode is kRtcpCompound_RFC4585. - virtual int SetRTCPStatus(const int videoChannel, - const ViERTCPMode rtcpMode) = 0; + // This function sets the RTCP status for the specified channel. + // Default mode is kRtcpCompound_RFC4585. + virtual int SetRTCPStatus(const int video_channel, + const ViERTCPMode rtcp_mode) = 0; - // This function gets the RTCP status for the specified channel. - virtual int GetRTCPStatus(const int videoChannel, - ViERTCPMode& rtcpMode) const = 0; + // This function gets the RTCP status for the specified channel. + virtual int GetRTCPStatus(const int video_channel, + ViERTCPMode& rtcp_mode) const = 0; - // This function sets the RTCP canonical name (CNAME) for the RTCP reports - // on a specific channel. - virtual int SetRTCPCName(const int videoChannel, - const char rtcpCName[KMaxRTCPCNameLength]) = 0; + // This function sets the RTCP canonical name (CNAME) for the RTCP reports + // on a specific channel. + virtual int SetRTCPCName(const int video_channel, + const char rtcp_cname[KMaxRTCPCNameLength]) = 0; - // This function gets the RTCP canonical name (CNAME) for the RTCP reports - // sent the specified channel. - virtual int GetRTCPCName(const int videoChannel, - char rtcpCName[KMaxRTCPCNameLength]) const = 0; + // This function gets the RTCP canonical name (CNAME) for the RTCP reports + // sent the specified channel. + virtual int GetRTCPCName(const int video_channel, + char rtcp_cname[KMaxRTCPCNameLength]) const = 0; - // This function gets the RTCP canonical name (CNAME) for the RTCP reports - // received on the specified channel. - virtual int GetRemoteRTCPCName( - const int videoChannel, char rtcpCName[KMaxRTCPCNameLength]) const = 0; + // This function gets the RTCP canonical name (CNAME) for the RTCP reports + // received on the specified channel. + virtual int GetRemoteRTCPCName( + const int video_channel, + char rtcp_cname[KMaxRTCPCNameLength]) const = 0; - // This function sends an RTCP APP packet on a specific channel. - virtual int SendApplicationDefinedRTCPPacket( - const int videoChannel, const unsigned char subType, - unsigned int name, const char* data, - unsigned short dataLengthInBytes) = 0; + // This function sends an RTCP APP packet on a specific channel. + virtual int SendApplicationDefinedRTCPPacket( + const int video_channel, + const unsigned char sub_type, + unsigned int name, + const char* data, + unsigned short data_length_in_bytes) = 0; - // This function enables Negative Acknowledgment (NACK) using RTCP, - // implemented based on RFC 4585. NACK retransmits RTP packets if lost on - // the network. This creates a lossless transport at the expense of delay. - // If using NACK, NACK should be enabled on both endpoints in a call. - virtual int SetNACKStatus(const int videoChannel, const bool enable) = 0; + // This function enables Negative Acknowledgment (NACK) using RTCP, + // implemented based on RFC 4585. NACK retransmits RTP packets if lost on + // the network. This creates a lossless transport at the expense of delay. + // If using NACK, NACK should be enabled on both endpoints in a call. + virtual int SetNACKStatus(const int video_channel, const bool enable) = 0; - // This function enables Forward Error Correction (FEC) using RTCP, - // implemented based on RFC 5109, to improve packet loss robustness. Extra - // FEC packets are sent together with the usual media packets, hence - // part of the bitrate will be used for FEC packets. - virtual int SetFECStatus(const int videoChannel, const bool enable, - const unsigned char payloadTypeRED, - const unsigned char payloadTypeFEC) = 0; + // This function enables Forward Error Correction (FEC) using RTCP, + // implemented based on RFC 5109, to improve packet loss robustness. Extra + // FEC packets are sent together with the usual media packets, hence + // part of the bitrate will be used for FEC packets. + virtual int SetFECStatus(const int video_channel, + const bool enable, + const unsigned char payload_typeRED, + const unsigned char payload_typeFEC) = 0; - // This function enables hybrid Negative Acknowledgment using RTCP - // and Forward Error Correction (FEC) implemented based on RFC 5109, - // to improve packet loss robustness. Extra - // FEC packets are sent together with the usual media packets, hence will - // part of the bitrate be used for FEC packets. - // The hybrid mode will choose between nack only, fec only and both based on - // network conditions. When both are applied, only packets that were not - // recovered by the FEC will be nacked. - virtual int SetHybridNACKFECStatus(const int videoChannel, - const bool enable, - const unsigned char payloadTypeRED, - const unsigned char payloadTypeFEC) = 0; + // This function enables hybrid Negative Acknowledgment using RTCP + // and Forward Error Correction (FEC) implemented based on RFC 5109, + // to improve packet loss robustness. Extra + // FEC packets are sent together with the usual media packets, hence will + // part of the bitrate be used for FEC packets. + // The hybrid mode will choose between nack only, fec only and both based on + // network conditions. When both are applied, only packets that were not + // recovered by the FEC will be nacked. + virtual int SetHybridNACKFECStatus(const int video_channel, + const bool enable, + const unsigned char payload_typeRED, + const unsigned char payload_typeFEC) = 0; - // This function enables RTCP key frame requests. - virtual int SetKeyFrameRequestMethod( - const int videoChannel, const ViEKeyFrameRequestMethod method) = 0; + // This function enables RTCP key frame requests. + virtual int SetKeyFrameRequestMethod( + const int video_channel, const ViEKeyFrameRequestMethod method) = 0; - // This function enables signaling of temporary bitrate constraints using - // RTCP, implemented based on RFC4585. - virtual int SetTMMBRStatus(const int videoChannel, const bool enable) = 0; + // This function enables signaling of temporary bitrate constraints using + // RTCP, implemented based on RFC4585. + virtual int SetTMMBRStatus(const int video_channel, const bool enable) = 0; - // Enables and disables REMB packets for this channel. |sender| indicates - // this channel is encoding, |receiver| tells the bitrate estimate for - // this channel should be included in the REMB packet. - virtual bool SetRembStatus(int video_channel, bool sender, - bool receiver) = 0; + // Enables and disables REMB packets for this channel. |sender| indicates + // this channel is encoding, |receiver| tells the bitrate estimate for + // this channel should be included in the REMB packet. + virtual bool SetRembStatus(int video_channel, + bool sender, + bool receiver) = 0; - // The function gets statistics from the received RTCP report. - virtual int GetReceivedRTCPStatistics( - const int videoChannel, unsigned short& fractionLost, - unsigned int& cumulativeLost, unsigned int& extendedMax, - unsigned int& jitter, int& rttMs) const = 0; + // The function gets statistics from the received RTCP report. + virtual int GetReceivedRTCPStatistics( + const int video_channel, + unsigned short& fraction_lost, + unsigned int& cumulative_lost, + unsigned int& extended_max, + unsigned int& jitter, + int& rtt_ms) const = 0; - // The function gets statistics from the RTCP report sent to the receiver. - virtual int GetSentRTCPStatistics(const int videoChannel, - unsigned short& fractionLost, - unsigned int& cumulativeLost, - unsigned int& extendedMax, - unsigned int& jitter, - int& rttMs) const = 0; + // The function gets statistics from the RTCP report sent to the receiver. + virtual int GetSentRTCPStatistics(const int video_channel, + unsigned short& fraction_lost, + unsigned int& cumulative_lost, + unsigned int& extended_max, + unsigned int& jitter, + int& rtt_ms) const = 0; - // The function gets statistics from the sent and received RTP streams. - virtual int GetRTPStatistics(const int videoChannel, - unsigned int& bytesSent, - unsigned int& packetsSent, - unsigned int& bytesReceived, - unsigned int& packetsReceived) const = 0; + // The function gets statistics from the sent and received RTP streams. + virtual int GetRTPStatistics(const int video_channel, + unsigned int& bytes_sent, + unsigned int& packets_sent, + unsigned int& bytes_received, + unsigned int& packets_received) const = 0; - // The function gets bandwidth usage statistics from the sent RTP streams in - // bits/s. - virtual int GetBandwidthUsage(const int videoChannel, - unsigned int& totalBitrateSent, - unsigned int& videoBitrateSent, - unsigned int& fecBitrateSent, - unsigned int& nackBitrateSent) const = 0; + // The function gets bandwidth usage statistics from the sent RTP streams in + // bits/s. + virtual int GetBandwidthUsage(const int video_channel, + unsigned int& total_bitrate_sent, + unsigned int& video_bitrate_sent, + unsigned int& fec_bitrate_sent, + unsigned int& nackBitrateSent) const = 0; - // This function enables or disables an RTP keep-alive mechanism which can - // be used to maintain an existing Network Address Translator (NAT) mapping - // while regular RTP is no longer transmitted. - virtual int SetRTPKeepAliveStatus( - const int videoChannel, bool enable, const char unknownPayloadType, - const unsigned int deltaTransmitTimeSeconds = - KDefaultDeltaTransmitTimeSeconds) = 0; + // This function enables or disables an RTP keep-alive mechanism which can + // be used to maintain an existing Network Address Translator (NAT) mapping + // while regular RTP is no longer transmitted. + virtual int SetRTPKeepAliveStatus( + const int video_channel, + bool enable, + const char unknown_payload_type, + const unsigned int delta_transmit_time_seconds = + KDefaultDeltaTransmitTimeSeconds) = 0; - // This function gets the RTP keep-alive status. - virtual int GetRTPKeepAliveStatus( - const int videoChannel, bool& enabled, char& unkownPayloadType, - unsigned int& deltaTransmitTimeSeconds) const = 0; + // This function gets the RTP keep-alive status. + virtual int GetRTPKeepAliveStatus( + const int video_channel, + bool& enabled, + char& unkown_payload_type, + unsigned int& delta_transmit_time_seconds) const = 0; - // This function enables capturing of RTP packets to a binary file on a - // specific channel and for a given direction. The file can later be - // replayed using e.g. RTP Tools rtpplay since the binary file format is - // compatible with the rtpdump format. - virtual int StartRTPDump(const int videoChannel, - const char fileNameUTF8[1024], - RTPDirections direction) = 0; + // This function enables capturing of RTP packets to a binary file on a + // specific channel and for a given direction. The file can later be + // replayed using e.g. RTP Tools rtpplay since the binary file format is + // compatible with the rtpdump format. + virtual int StartRTPDump(const int video_channel, + const char file_nameUTF8[1024], + RTPDirections direction) = 0; - // This function disables capturing of RTP packets to a binary file on a - // specific channel and for a given direction. - virtual int StopRTPDump(const int videoChannel, - RTPDirections direction) = 0; + // This function disables capturing of RTP packets to a binary file on a + // specific channel and for a given direction. + virtual int StopRTPDump(const int video_channel, + RTPDirections direction) = 0; - // Registers an instance of a user implementation of the ViERTPObserver. - virtual int RegisterRTPObserver(const int videoChannel, - ViERTPObserver& observer) = 0; + // Registers an instance of a user implementation of the ViERTPObserver. + virtual int RegisterRTPObserver(const int video_channel, + ViERTPObserver& observer) = 0; - // Removes a registered instance of ViERTPObserver. - virtual int DeregisterRTPObserver(const int videoChannel) = 0; + // Removes a registered instance of ViERTPObserver. + virtual int DeregisterRTPObserver(const int video_channel) = 0; - // Registers an instance of a user implementation of the ViERTCPObserver. - virtual int RegisterRTCPObserver(const int videoChannel, - ViERTCPObserver& observer) = 0; + // Registers an instance of a user implementation of the ViERTCPObserver. + virtual int RegisterRTCPObserver(const int video_channel, + ViERTCPObserver& observer) = 0; - // Removes a registered instance of ViERTCPObserver. - virtual int DeregisterRTCPObserver(const int videoChannel) = 0; + // Removes a registered instance of ViERTCPObserver. + virtual int DeregisterRTCPObserver(const int video_channel) = 0; -protected: - ViERTP_RTCP() {}; - virtual ~ViERTP_RTCP() {}; + protected: + ViERTP_RTCP() {} + virtual ~ViERTP_RTCP() {} }; -} // namespace webrtc -#endif // WEBRTC_VIDEO_ENGINE_MAIN_INTERFACE_VIE_RTP_RTCP_H_ + +} // namespace webrtc + +#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RTP_RTCP_H_