From b7a88291dc9506165eba58975afc73b520daaf80 Mon Sep 17 00:00:00 2001 From: kjellander Date: Tue, 24 Nov 2015 07:13:48 -0800 Subject: [PATCH] Remove duplicated headers after updating downstream code. Remove the headers that were kept to provide non-breaking updates of downstream code for https://codereview.webrtc.org/1418913006/ and https://codereview.webrtc.org/1417283007/. BUG=webrtc:5095 TESTED=Passing compile-trybots with --clobber flag: git cl try --clobber --bot=win_compile_rel --bot=linux_compile_rel --bot=android_compile_rel --bot=mac_compile_rel --bot=ios_rel --bot=linux_gn_rel --bot=win_x64_gn_rel --bot=mac_x64_gn_rel --bot=android_gn_rel -m tryserver.webrtc NOTRY=True Review URL: https://codereview.webrtc.org/1467173003 Cr-Commit-Position: refs/heads/master@{#10773} --- .../common_video/interface/i420_buffer_pool.h | 45 -- .../interface/incoming_video_stream.h | 104 ---- .../interface/video_frame_buffer.h | 159 ------ webrtc/common_video/interface/video_image.h | 19 - .../main/interface/mock/mock_vcm_callbacks.h | 37 -- .../main/interface/video_coding.h | 531 ------------------ .../main/interface/video_coding_defines.h | 203 ------- .../video_coding/main/source/encoded_frame.h | 129 ----- 8 files changed, 1227 deletions(-) delete mode 100644 webrtc/common_video/interface/i420_buffer_pool.h delete mode 100644 webrtc/common_video/interface/incoming_video_stream.h delete mode 100644 webrtc/common_video/interface/video_frame_buffer.h delete mode 100644 webrtc/common_video/interface/video_image.h delete mode 100644 webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h delete mode 100644 webrtc/modules/video_coding/main/interface/video_coding.h delete mode 100644 webrtc/modules/video_coding/main/interface/video_coding_defines.h delete mode 100644 webrtc/modules/video_coding/main/source/encoded_frame.h diff --git a/webrtc/common_video/interface/i420_buffer_pool.h b/webrtc/common_video/interface/i420_buffer_pool.h deleted file mode 100644 index 37021d6383..0000000000 --- a/webrtc/common_video/interface/i420_buffer_pool.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ - -#pragma message("WARNING: common_video/include is DEPRECATED; use common_video/include") - -#include - -#include "webrtc/base/thread_checker.h" -#include "webrtc/common_video/include/video_frame_buffer.h" - -namespace webrtc { - -// Simple buffer pool to avoid unnecessary allocations of I420Buffer objects. -// The pool manages the memory of the I420Buffer returned from CreateBuffer. -// When the I420Buffer is destructed, the memory is returned to the pool for use -// by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer -// changes, old buffers will be purged from the pool. -class I420BufferPool { - public: - I420BufferPool(); - // Returns a buffer from the pool, or creates a new buffer if no suitable - // buffer exists in the pool. - rtc::scoped_refptr CreateBuffer(int width, int height); - // Clears buffers_ and detaches the thread checker so that it can be reused - // later from another thread. - void Release(); - - private: - rtc::ThreadChecker thread_checker_; - std::list> buffers_; -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ diff --git a/webrtc/common_video/interface/incoming_video_stream.h b/webrtc/common_video/interface/incoming_video_stream.h deleted file mode 100644 index 00519ec2cc..0000000000 --- a/webrtc/common_video/interface/incoming_video_stream.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ - -#pragma message("WARNING: common_video/include is DEPRECATED; use common_video/include") - -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/thread_annotations.h" -#include "webrtc/common_video/video_render_frames.h" - -namespace webrtc { -class CriticalSectionWrapper; -class EventTimerWrapper; -class PlatformThread; - -class VideoRenderCallback { - public: - virtual int32_t RenderFrame(const uint32_t streamId, - const VideoFrame& videoFrame) = 0; - - protected: - virtual ~VideoRenderCallback() {} -}; - -class IncomingVideoStream : public VideoRenderCallback { - public: - explicit IncomingVideoStream(uint32_t stream_id); - ~IncomingVideoStream(); - - // Get callback to deliver frames to the module. - VideoRenderCallback* ModuleCallback(); - virtual int32_t RenderFrame(const uint32_t stream_id, - const VideoFrame& video_frame); - - // Set callback to the platform dependent code. - void SetRenderCallback(VideoRenderCallback* render_callback); - - // Callback for file recording, snapshot, ... - void SetExternalCallback(VideoRenderCallback* render_object); - - // Start/Stop. - int32_t Start(); - int32_t Stop(); - - // Clear all buffers. - int32_t Reset(); - - // Properties. - uint32_t StreamId() const; - uint32_t IncomingRate() const; - - int32_t SetStartImage(const VideoFrame& video_frame); - - int32_t SetTimeoutImage(const VideoFrame& video_frame, - const uint32_t timeout); - - int32_t SetExpectedRenderDelay(int32_t delay_ms); - - protected: - static bool IncomingVideoStreamThreadFun(void* obj); - bool IncomingVideoStreamProcess(); - - private: - enum { kEventStartupTimeMs = 10 }; - enum { kEventMaxWaitTimeMs = 100 }; - enum { kFrameRatePeriodMs = 1000 }; - - uint32_t const stream_id_; - // Critsects in allowed to enter order. - const rtc::scoped_ptr stream_critsect_; - const rtc::scoped_ptr thread_critsect_; - const rtc::scoped_ptr buffer_critsect_; - rtc::scoped_ptr incoming_render_thread_ - GUARDED_BY(thread_critsect_); - rtc::scoped_ptr deliver_buffer_event_; - - bool running_ GUARDED_BY(stream_critsect_); - VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_); - VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_); - const rtc::scoped_ptr render_buffers_ - GUARDED_BY(buffer_critsect_); - - uint32_t incoming_rate_ GUARDED_BY(stream_critsect_); - int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_); - uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_); - int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_); - VideoFrame temp_frame_ GUARDED_BY(thread_critsect_); - VideoFrame start_image_ GUARDED_BY(thread_critsect_); - VideoFrame timeout_image_ GUARDED_BY(thread_critsect_); - uint32_t timeout_time_ GUARDED_BY(thread_critsect_); -}; - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_ diff --git a/webrtc/common_video/interface/video_frame_buffer.h b/webrtc/common_video/interface/video_frame_buffer.h deleted file mode 100644 index 0b1c3233fd..0000000000 --- a/webrtc/common_video/interface/video_frame_buffer.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ - -#pragma message("WARNING: common_video/include is DEPRECATED; use common_video/include") - -#include "webrtc/base/callback.h" -#include "webrtc/base/refcount.h" -#include "webrtc/base/scoped_ptr.h" -#include "webrtc/base/scoped_ref_ptr.h" -#include "webrtc/system_wrappers/include/aligned_malloc.h" - -namespace webrtc { - -enum PlaneType { - kYPlane = 0, - kUPlane = 1, - kVPlane = 2, - kNumOfPlanes = 3, -}; - -// Interface of a simple frame buffer containing pixel data. This interface does -// not contain any frame metadata such as rotation, timestamp, pixel_width, etc. -class VideoFrameBuffer : public rtc::RefCountInterface { - public: - // Returns true if this buffer has a single exclusive owner. - virtual bool HasOneRef() const = 0; - - // The resolution of the frame in pixels. For formats where some planes are - // subsampled, this is the highest-resolution plane. - virtual int width() const = 0; - virtual int height() const = 0; - - // Returns pointer to the pixel data for a given plane. The memory is owned by - // the VideoFrameBuffer object and must not be freed by the caller. - virtual const uint8_t* data(PlaneType type) const = 0; - - // Non-const data access is disallowed by default. You need to make sure you - // have exclusive access and a writable buffer before calling this function. - virtual uint8_t* MutableData(PlaneType type); - - // Returns the number of bytes between successive rows for a given plane. - virtual int stride(PlaneType type) const = 0; - - // Return the handle of the underlying video frame. This is used when the - // frame is backed by a texture. - virtual void* native_handle() const = 0; - - // Returns a new memory-backed frame buffer converted from this buffer's - // native handle. - virtual rtc::scoped_refptr NativeToI420Buffer() = 0; - - protected: - virtual ~VideoFrameBuffer(); -}; - -// Plain I420 buffer in standard memory. -class I420Buffer : public VideoFrameBuffer { - public: - I420Buffer(int width, int height); - I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); - - int width() const override; - int height() const override; - const uint8_t* data(PlaneType type) const override; - // Non-const data access is only allowed if HasOneRef() is true to protect - // against unexpected overwrites. - uint8_t* MutableData(PlaneType type) override; - int stride(PlaneType type) const override; - void* native_handle() const override; - rtc::scoped_refptr NativeToI420Buffer() override; - - protected: - ~I420Buffer() override; - - private: - const int width_; - const int height_; - const int stride_y_; - const int stride_u_; - const int stride_v_; - const rtc::scoped_ptr data_; -}; - -// Base class for native-handle buffer is a wrapper around a |native_handle|. -// This is used for convenience as most native-handle implementations can share -// many VideoFrame implementations, but need to implement a few others (such -// as their own destructors or conversion methods back to software I420). -class NativeHandleBuffer : public VideoFrameBuffer { - public: - NativeHandleBuffer(void* native_handle, int width, int height); - - int width() const override; - int height() const override; - const uint8_t* data(PlaneType type) const override; - int stride(PlaneType type) const override; - void* native_handle() const override; - - protected: - void* native_handle_; - const int width_; - const int height_; -}; - -class WrappedI420Buffer : public webrtc::VideoFrameBuffer { - public: - WrappedI420Buffer(int width, - int height, - const uint8_t* y_plane, - int y_stride, - const uint8_t* u_plane, - int u_stride, - const uint8_t* v_plane, - int v_stride, - const rtc::Callback0& no_longer_used); - int width() const override; - int height() const override; - - const uint8_t* data(PlaneType type) const override; - - int stride(PlaneType type) const override; - void* native_handle() const override; - - rtc::scoped_refptr NativeToI420Buffer() override; - - private: - friend class rtc::RefCountedObject; - ~WrappedI420Buffer() override; - - const int width_; - const int height_; - const uint8_t* const y_plane_; - const uint8_t* const u_plane_; - const uint8_t* const v_plane_; - const int y_stride_; - const int u_stride_; - const int v_stride_; - rtc::Callback0 no_longer_used_cb_; -}; - -// Helper function to crop |buffer| without making a deep copy. May only be used -// for non-native frames. -rtc::scoped_refptr ShallowCenterCrop( - const rtc::scoped_refptr& buffer, - int cropped_width, - int cropped_height); - -} // namespace webrtc - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ diff --git a/webrtc/common_video/interface/video_image.h b/webrtc/common_video/interface/video_image.h deleted file mode 100644 index c0f3b2f054..0000000000 --- a/webrtc/common_video/interface/video_image.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_IMAGE_H_ -#define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_IMAGE_H_ - -#pragma message("WARNING: common_video/include is DEPRECATED; use common_video/include") - -// TODO(pbos): Remove this file and include webrtc/video_frame.h instead. -#include "webrtc/video_frame.h" - -#endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_IMAGE_H_ diff --git a/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h b/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h deleted file mode 100644 index 05a2939bd5..0000000000 --- a/webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_INCLUDE_MOCK_MOCK_VCM_CALLBACKS_H_ -#define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_MOCK_MOCK_VCM_CALLBACKS_H_ - -#pragma message("WARNING: video_coding/main/interface is DEPRECATED; use video_coding/include") - -#include "testing/gmock/include/gmock/gmock.h" -#include "webrtc/modules/video_coding/include/video_coding_defines.h" -#include "webrtc/typedefs.h" - -namespace webrtc { - -class MockVCMFrameTypeCallback : public VCMFrameTypeCallback { - public: - MOCK_METHOD0(RequestKeyFrame, int32_t()); - MOCK_METHOD1(SliceLossIndicationRequest, - int32_t(const uint64_t pictureId)); -}; - -class MockPacketRequestCallback : public VCMPacketRequestCallback { - public: - MOCK_METHOD2(ResendPackets, int32_t(const uint16_t* sequenceNumbers, - uint16_t length)); -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_MOCK_MOCK_VCM_CALLBACKS_H_ diff --git a/webrtc/modules/video_coding/main/interface/video_coding.h b/webrtc/modules/video_coding/main/interface/video_coding.h deleted file mode 100644 index f965e90c2e..0000000000 --- a/webrtc/modules/video_coding/main/interface/video_coding.h +++ /dev/null @@ -1,531 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_H_ -#define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_H_ - -#pragma message("WARNING: video_coding/main/interface is DEPRECATED; use video_coding/include") - -#if defined(WEBRTC_WIN) -// This is a workaround on Windows due to the fact that some Windows -// headers define CreateEvent as a macro to either CreateEventW or CreateEventA. -// This can cause problems since we use that name as well and could -// declare them as one thing here whereas in another place a windows header -// may have been included and then implementing CreateEvent() causes compilation -// errors. So for consistency, we include the main windows header here. -#include -#endif - -#include "webrtc/modules/include/module.h" -#include "webrtc/modules/include/module_common_types.h" -#include "webrtc/modules/video_coding/include/video_coding_defines.h" -#include "webrtc/system_wrappers/include/event_wrapper.h" -#include "webrtc/video_frame.h" - -namespace webrtc -{ - -class Clock; -class EncodedImageCallback; -class VideoEncoder; -class VideoDecoder; -struct CodecSpecificInfo; - -class EventFactory { - public: - virtual ~EventFactory() {} - - virtual EventWrapper* CreateEvent() = 0; -}; - -class EventFactoryImpl : public EventFactory { - public: - virtual ~EventFactoryImpl() {} - - virtual EventWrapper* CreateEvent() { - return EventWrapper::Create(); - } -}; - -// Used to indicate which decode with errors mode should be used. -enum VCMDecodeErrorMode { - kNoErrors, // Never decode with errors. Video will freeze - // if nack is disabled. - kSelectiveErrors, // Frames that are determined decodable in - // VCMSessionInfo may be decoded with missing - // packets. As not all incomplete frames will be - // decodable, video will freeze if nack is disabled. - kWithErrors // Release frames as needed. Errors may be - // introduced as some encoded frames may not be - // complete. -}; - -class VideoCodingModule : public Module -{ -public: - enum SenderNackMode { - kNackNone, - kNackAll, - kNackSelective - }; - - enum ReceiverRobustness { - kNone, - kHardNack, - kSoftNack, - kReferenceSelection - }; - - static VideoCodingModule* Create( - Clock* clock, - VideoEncoderRateObserver* encoder_rate_observer, - VCMQMSettingsCallback* qm_settings_callback); - - static VideoCodingModule* Create(Clock* clock, EventFactory* event_factory); - - static void Destroy(VideoCodingModule* module); - - // Get supported codec settings using codec type - // - // Input: - // - codecType : The codec type to get settings for - // - codec : Memory where the codec settings will be stored - // - // Return value : VCM_OK, on success - // VCM_PARAMETER_ERROR if codec not supported - static int32_t Codec(VideoCodecType codecType, VideoCodec* codec); - - /* - * Sender - */ - - // Registers a codec to be used for encoding. Calling this - // API multiple times overwrites any previously registered codecs. - // - // NOTE: Must be called on the thread that constructed the VCM instance. - // - // Input: - // - sendCodec : Settings for the codec to be registered. - // - numberOfCores : The number of cores the codec is allowed - // to use. - // - maxPayloadSize : The maximum size each payload is allowed - // to have. Usually MTU - overhead. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec, - uint32_t numberOfCores, - uint32_t maxPayloadSize) = 0; - - // Get the current send codec in use. - // - // If a codec has not been set yet, the |id| property of the return value - // will be 0 and |name| empty. - // - // NOTE: This method intentionally does not hold locks and minimizes data - // copying. It must be called on the thread where the VCM was constructed. - virtual const VideoCodec& GetSendCodec() const = 0; - - // DEPRECATED: Use GetSendCodec() instead. - // - // API to get the current send codec in use. - // - // Input: - // - currentSendCodec : Address where the sendCodec will be written. - // - // Return value : VCM_OK, on success. - // < 0, on error. - // - // NOTE: The returned codec information is not guaranteed to be current when - // the call returns. This method acquires a lock that is aligned with - // video encoding, so it should be assumed to be allowed to block for - // several milliseconds. - virtual int32_t SendCodec(VideoCodec* currentSendCodec) const = 0; - - // DEPRECATED: Use GetSendCodec() instead. - // - // API to get the current send codec type - // - // Return value : Codec type, on success. - // kVideoCodecUnknown, on error or if no send codec is set - // NOTE: Same notes apply as for SendCodec() above. - virtual VideoCodecType SendCodec() const = 0; - - // Register an external encoder object. This can not be used together with - // external decoder callbacks. - // - // Input: - // - externalEncoder : Encoder object to be used for encoding frames inserted - // with the AddVideoFrame API. - // - payloadType : The payload type bound which this encoder is bound to. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder, - uint8_t payloadType, - bool internalSource = false) = 0; - - // API to get currently configured encoder target bitrate in bits/s. - // - // Return value : 0, on success. - // < 0, on error. - virtual int Bitrate(unsigned int* bitrate) const = 0; - - // API to get currently configured encoder target frame rate. - // - // Return value : 0, on success. - // < 0, on error. - virtual int FrameRate(unsigned int* framerate) const = 0; - - // Sets the parameters describing the send channel. These parameters are inputs to the - // Media Optimization inside the VCM and also specifies the target bit rate for the - // encoder. Bit rate used by NACK should already be compensated for by the user. - // - // Input: - // - target_bitrate : The target bitrate for VCM in bits/s. - // - lossRate : Fractions of lost packets the past second. - // (loss rate in percent = 100 * packetLoss / 255) - // - rtt : Current round-trip time in ms. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t SetChannelParameters(uint32_t target_bitrate, - uint8_t lossRate, - int64_t rtt) = 0; - - // Sets the parameters describing the receive channel. These parameters are inputs to the - // Media Optimization inside the VCM. - // - // Input: - // - rtt : Current round-trip time in ms. - // with the most amount available bandwidth in a conference - // scenario - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t SetReceiveChannelParameters(int64_t rtt) = 0; - - // Register a transport callback which will be called to deliver the encoded data and - // side information. - // - // Input: - // - transport : The callback object to register. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterTransportCallback(VCMPacketizationCallback* transport) = 0; - - // Register video output information callback which will be called to deliver information - // about the video stream produced by the encoder, for instance the average frame rate and - // bit rate. - // - // Input: - // - outputInformation : The callback object to register. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterSendStatisticsCallback( - VCMSendStatisticsCallback* sendStats) = 0; - - // Register a video protection callback which will be called to deliver - // the requested FEC rate and NACK status (on/off). - // - // Input: - // - protection : The callback object to register. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterProtectionCallback(VCMProtectionCallback* protection) = 0; - - // Enable or disable a video protection method. - // - // Input: - // - videoProtection : The method to enable or disable. - // - enable : True if the method should be enabled, false if - // it should be disabled. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection, - bool enable) = 0; - - // Add one raw video frame to the encoder. This function does all the necessary - // processing, then decides what frame type to encode, or if the frame should be - // dropped. If the frame should be encoded it passes the frame to the encoder - // before it returns. - // - // Input: - // - videoFrame : Video frame to encode. - // - codecSpecificInfo : Extra codec information, e.g., pre-parsed in-band signaling. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t AddVideoFrame( - const VideoFrame& videoFrame, - const VideoContentMetrics* contentMetrics = NULL, - const CodecSpecificInfo* codecSpecificInfo = NULL) = 0; - - // Next frame encoded should be an intra frame (keyframe). - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t IntraFrameRequest(int stream_index) = 0; - - // Frame Dropper enable. Can be used to disable the frame dropping when the encoder - // over-uses its bit rate. This API is designed to be used when the encoded frames - // are supposed to be stored to an AVI file, or when the I420 codec is used and the - // target bit rate shouldn't affect the frame rate. - // - // Input: - // - enable : True to enable the setting, false to disable it. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t EnableFrameDropper(bool enable) = 0; - - - /* - * Receiver - */ - - // Register possible receive codecs, can be called multiple times for different codecs. - // The module will automatically switch between registered codecs depending on the - // payload type of incoming frames. The actual decoder will be created when needed. - // - // Input: - // - receiveCodec : Settings for the codec to be registered. - // - numberOfCores : Number of CPU cores that the decoder is allowed to use. - // - requireKeyFrame : Set this to true if you don't want any delta frames - // to be decoded until the first key frame has been decoded. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec, - int32_t numberOfCores, - bool requireKeyFrame = false) = 0; - - // Register an externally defined decoder/renderer object. Can be a decoder only or a - // decoder coupled with a renderer. Note that RegisterReceiveCodec must be called to - // be used for decoding incoming streams. - // - // Input: - // - externalDecoder : The external decoder/renderer object. - // - payloadType : The payload type which this decoder should be - // registered to. - // - internalRenderTiming : True if the internal renderer (if any) of the decoder - // object can make sure to render at a given time in ms. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterExternalDecoder(VideoDecoder* externalDecoder, - uint8_t payloadType, - bool internalRenderTiming) = 0; - - // Register a receive callback. Will be called whenever there is a new frame ready - // for rendering. - // - // Input: - // - receiveCallback : The callback object to be used by the module when a - // frame is ready for rendering. - // De-register with a NULL pointer. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterReceiveCallback(VCMReceiveCallback* receiveCallback) = 0; - - // Register a receive statistics callback which will be called to deliver information - // about the video stream received by the receiving side of the VCM, for instance the - // average frame rate and bit rate. - // - // Input: - // - receiveStats : The callback object to register. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterReceiveStatisticsCallback( - VCMReceiveStatisticsCallback* receiveStats) = 0; - - // Register a decoder timing callback which will be called to deliver - // information about the timing of the decoder in the receiving side of the - // VCM, for instance the current and maximum frame decode latency. - // - // Input: - // - decoderTiming : The callback object to register. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterDecoderTimingCallback( - VCMDecoderTimingCallback* decoderTiming) = 0; - - // Register a frame type request callback. This callback will be called when the - // module needs to request specific frame types from the send side. - // - // Input: - // - frameTypeCallback : The callback object to be used by the module when - // requesting a specific type of frame from the send side. - // De-register with a NULL pointer. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterFrameTypeCallback( - VCMFrameTypeCallback* frameTypeCallback) = 0; - - // Registers a callback which is called whenever the receive side of the VCM - // encounters holes in the packet sequence and needs packets to be retransmitted. - // - // Input: - // - callback : The callback to be registered in the VCM. - // - // Return value : VCM_OK, on success. - // <0, on error. - virtual int32_t RegisterPacketRequestCallback( - VCMPacketRequestCallback* callback) = 0; - - // Waits for the next frame in the jitter buffer to become complete - // (waits no longer than maxWaitTimeMs), then passes it to the decoder for decoding. - // Should be called as often as possible to get the most out of the decoder. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t Decode(uint16_t maxWaitTimeMs = 200) = 0; - - // Registers a callback which conveys the size of the render buffer. - virtual int RegisterRenderBufferSizeCallback( - VCMRenderBufferSizeCallback* callback) = 0; - - // Reset the decoder state to the initial state. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t ResetDecoder() = 0; - - // API to get the codec which is currently used for decoding by the module. - // - // Input: - // - currentReceiveCodec : Settings for the codec to be registered. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const = 0; - - // API to get the codec type currently used for decoding by the module. - // - // Return value : codecy type, on success. - // kVideoCodecUnknown, on error or if no receive codec is registered - virtual VideoCodecType ReceiveCodec() const = 0; - - // Insert a parsed packet into the receiver side of the module. Will be placed in the - // jitter buffer waiting for the frame to become complete. Returns as soon as the packet - // has been placed in the jitter buffer. - // - // Input: - // - incomingPayload : Payload of the packet. - // - payloadLength : Length of the payload. - // - rtpInfo : The parsed header. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t IncomingPacket(const uint8_t* incomingPayload, - size_t payloadLength, - const WebRtcRTPHeader& rtpInfo) = 0; - - // Minimum playout delay (Used for lip-sync). This is the minimum delay required - // to sync with audio. Not included in VideoCodingModule::Delay() - // Defaults to 0 ms. - // - // Input: - // - minPlayoutDelayMs : Additional delay in ms. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs) = 0; - - // Set the time required by the renderer to render a frame. - // - // Input: - // - timeMS : The time in ms required by the renderer to render a frame. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t SetRenderDelay(uint32_t timeMS) = 0; - - // The total delay desired by the VCM. Can be less than the minimum - // delay set with SetMinimumPlayoutDelay. - // - // Return value : Total delay in ms, on success. - // < 0, on error. - virtual int32_t Delay() const = 0; - - // Returns the number of packets discarded by the jitter buffer due to being - // too late. This can include duplicated packets which arrived after the - // frame was sent to the decoder. Therefore packets which were prematurely - // NACKed will be counted. - virtual uint32_t DiscardedPackets() const = 0; - - - // Robustness APIs - - // Set the receiver robustness mode. The mode decides how the receiver - // responds to losses in the stream. The type of counter-measure (soft or - // hard NACK, dual decoder, RPS, etc.) is selected through the - // robustnessMode parameter. The errorMode parameter decides if it is - // allowed to display frames corrupted by losses. Note that not all - // combinations of the two parameters are feasible. An error will be - // returned for invalid combinations. - // Input: - // - robustnessMode : selected robustness mode. - // - errorMode : selected error mode. - // - // Return value : VCM_OK, on success; - // < 0, on error. - virtual int SetReceiverRobustnessMode(ReceiverRobustness robustnessMode, - VCMDecodeErrorMode errorMode) = 0; - - // Set the decode error mode. The mode decides which errors (if any) are - // allowed in decodable frames. Note that setting decode_error_mode to - // anything other than kWithErrors without enabling nack will cause - // long-term freezes (resulting from frequent key frame requests) if - // packet loss occurs. - virtual void SetDecodeErrorMode(VCMDecodeErrorMode decode_error_mode) = 0; - - // Sets the maximum number of sequence numbers that we are allowed to NACK - // and the oldest sequence number that we will consider to NACK. If a - // sequence number older than |max_packet_age_to_nack| is missing - // a key frame will be requested. A key frame will also be requested if the - // time of incomplete or non-continuous frames in the jitter buffer is above - // |max_incomplete_time_ms|. - virtual void SetNackSettings(size_t max_nack_list_size, - int max_packet_age_to_nack, - int max_incomplete_time_ms) = 0; - - // Setting a desired delay to the VCM receiver. Video rendering will be - // delayed by at least desired_delay_ms. - virtual int SetMinReceiverDelay(int desired_delay_ms) = 0; - - // Lets the sender suspend video when the rate drops below - // |threshold_bps|, and turns back on when the rate goes back up above - // |threshold_bps| + |window_bps|. - virtual void SuspendBelowMinBitrate() = 0; - - // Returns true if SuspendBelowMinBitrate is engaged and the video has been - // suspended due to bandwidth limitations; otherwise false. - virtual bool VideoSuspended() const = 0; - - virtual void RegisterPreDecodeImageCallback( - EncodedImageCallback* observer) = 0; - virtual void RegisterPostEncodeImageCallback( - EncodedImageCallback* post_encode_callback) = 0; - // Releases pending decode calls, permitting faster thread shutdown. - virtual void TriggerDecoderShutdown() = 0; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_H_ diff --git a/webrtc/modules/video_coding/main/interface/video_coding_defines.h b/webrtc/modules/video_coding/main/interface/video_coding_defines.h deleted file mode 100644 index 833a355fc2..0000000000 --- a/webrtc/modules/video_coding/main/interface/video_coding_defines.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ -#define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ - -#pragma message("WARNING: video_coding/main/interface is DEPRECATED; use video_coding/include") - -#include "webrtc/modules/include/module_common_types.h" -#include "webrtc/typedefs.h" -#include "webrtc/video_frame.h" - -namespace webrtc { - -// Error codes -#define VCM_FRAME_NOT_READY 3 -#define VCM_REQUEST_SLI 2 -#define VCM_MISSING_CALLBACK 1 -#define VCM_OK 0 -#define VCM_GENERAL_ERROR -1 -#define VCM_LEVEL_EXCEEDED -2 -#define VCM_MEMORY -3 -#define VCM_PARAMETER_ERROR -4 -#define VCM_UNKNOWN_PAYLOAD -5 -#define VCM_CODEC_ERROR -6 -#define VCM_UNINITIALIZED -7 -#define VCM_NO_CODEC_REGISTERED -8 -#define VCM_JITTER_BUFFER_ERROR -9 -#define VCM_OLD_PACKET_ERROR -10 -#define VCM_NO_FRAME_DECODED -11 -#define VCM_ERROR_REQUEST_SLI -12 -#define VCM_NOT_IMPLEMENTED -20 - -enum { kDefaultStartBitrateKbps = 300 }; - -enum VCMVideoProtection { - kProtectionNone, - kProtectionNack, - kProtectionFEC, - kProtectionNackFEC, -}; - -enum VCMTemporalDecimation { - kBitrateOverUseDecimation, -}; - -struct VCMFrameCount { - uint32_t numKeyFrames; - uint32_t numDeltaFrames; -}; - -// Callback class used for sending data ready to be packetized -class VCMPacketizationCallback { - public: - virtual int32_t SendData(uint8_t payloadType, - const EncodedImage& encoded_image, - const RTPFragmentationHeader& fragmentationHeader, - const RTPVideoHeader* rtpVideoHdr) = 0; - - protected: - virtual ~VCMPacketizationCallback() { - } -}; - -// Callback class used for passing decoded frames which are ready to be rendered. -class VCMReceiveCallback { - public: - virtual int32_t FrameToRender(VideoFrame& videoFrame) = 0; - virtual int32_t ReceivedDecodedReferenceFrame( - const uint64_t pictureId) { - return -1; - } - // Called when the current receive codec changes. - virtual void OnIncomingPayloadType(int payload_type) {} - - protected: - virtual ~VCMReceiveCallback() { - } -}; - -// Callback class used for informing the user of the bit rate and frame rate produced by the -// encoder. -class VCMSendStatisticsCallback { - public: - virtual int32_t SendStatistics(const uint32_t bitRate, - const uint32_t frameRate) = 0; - - protected: - virtual ~VCMSendStatisticsCallback() { - } -}; - -// Callback class used for informing the user of the incoming bit rate and frame rate. -class VCMReceiveStatisticsCallback { - public: - virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0; - virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0; - virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0; - - protected: - virtual ~VCMReceiveStatisticsCallback() { - } -}; - -// Callback class used for informing the user of decode timing info. -class VCMDecoderTimingCallback { - public: - virtual void OnDecoderTiming(int decode_ms, - int max_decode_ms, - int current_delay_ms, - int target_delay_ms, - int jitter_buffer_ms, - int min_playout_delay_ms, - int render_delay_ms) = 0; - - protected: - virtual ~VCMDecoderTimingCallback() {} -}; - -// Callback class used for telling the user about how to configure the FEC, -// and the rates sent the last second is returned to the VCM. -class VCMProtectionCallback { - public: - virtual int ProtectionRequest(const FecProtectionParams* delta_params, - const FecProtectionParams* key_params, - uint32_t* sent_video_rate_bps, - uint32_t* sent_nack_rate_bps, - uint32_t* sent_fec_rate_bps) = 0; - - protected: - virtual ~VCMProtectionCallback() { - } -}; - -class VideoEncoderRateObserver { - public: - virtual ~VideoEncoderRateObserver() {} - virtual void OnSetRates(uint32_t bitrate_bps, int framerate) = 0; -}; - -// Callback class used for telling the user about what frame type needed to continue decoding. -// Typically a key frame when the stream has been corrupted in some way. -class VCMFrameTypeCallback { - public: - virtual int32_t RequestKeyFrame() = 0; - virtual int32_t SliceLossIndicationRequest( - const uint64_t pictureId) { - return -1; - } - - protected: - virtual ~VCMFrameTypeCallback() { - } -}; - -// Callback class used for telling the user about which packet sequence numbers are currently -// missing and need to be resent. -class VCMPacketRequestCallback { - public: - virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, - uint16_t length) = 0; - - protected: - virtual ~VCMPacketRequestCallback() { - } -}; - -// Callback used to inform the user of the the desired resolution -// as subscribed by Media Optimization (Quality Modes) -class VCMQMSettingsCallback { - public: - virtual int32_t SetVideoQMSettings(const uint32_t frameRate, - const uint32_t width, - const uint32_t height) = 0; - - virtual void SetTargetFramerate(int frame_rate) = 0; - - protected: - virtual ~VCMQMSettingsCallback() { - } -}; - -// Callback class used for telling the user about the size (in time) of the -// render buffer, that is the size in time of the complete continuous frames. -class VCMRenderBufferSizeCallback { - public: - virtual void RenderBufferSizeMs(int buffer_size_ms) = 0; - - protected: - virtual ~VCMRenderBufferSizeCallback() { - } -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.h b/webrtc/modules/video_coding/main/source/encoded_frame.h deleted file mode 100644 index a058655e5e..0000000000 --- a/webrtc/modules/video_coding/main/source/encoded_frame.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_VIDEO_CODING_ENCODED_FRAME_H_ -#define WEBRTC_MODULES_VIDEO_CODING_ENCODED_FRAME_H_ - -#pragma message("WARNING: video_coding/main/source is DEPRECATED; use video_coding/ instead.") - -#include - -#include "webrtc/common_types.h" -#include "webrtc/common_video/include/video_image.h" -#include "webrtc/modules/include/module_common_types.h" -#include "webrtc/modules/video_coding/include/video_codec_interface.h" -#include "webrtc/modules/video_coding/include/video_coding_defines.h" - -namespace webrtc -{ - -class VCMEncodedFrame : protected EncodedImage -{ -public: - VCMEncodedFrame(); - VCMEncodedFrame(const webrtc::EncodedImage& rhs); - VCMEncodedFrame(const VCMEncodedFrame& rhs); - - ~VCMEncodedFrame(); - /** - * Delete VideoFrame and resets members to zero - */ - void Free(); - /** - * Set render time in milliseconds - */ - void SetRenderTime(const int64_t renderTimeMs) {_renderTimeMs = renderTimeMs;} - - /** - * Set the encoded frame size - */ - void SetEncodedSize(uint32_t width, uint32_t height) - { _encodedWidth = width; _encodedHeight = height; } - /** - * Get the encoded image - */ - const webrtc::EncodedImage& EncodedImage() const - { return static_cast(*this); } - /** - * Get pointer to frame buffer - */ - const uint8_t* Buffer() const {return _buffer;} - /** - * Get frame length - */ - size_t Length() const {return _length;} - /** - * Get frame timestamp (90kHz) - */ - uint32_t TimeStamp() const {return _timeStamp;} - /** - * Get render time in milliseconds - */ - int64_t RenderTimeMs() const {return _renderTimeMs;} - /** - * Get frame type - */ - webrtc::FrameType FrameType() const { return _frameType; } - /** - * Get frame rotation - */ - VideoRotation rotation() const { return _rotation; } - /** - * True if this frame is complete, false otherwise - */ - bool Complete() const { return _completeFrame; } - /** - * True if there's a frame missing before this frame - */ - bool MissingFrame() const { return _missingFrame; } - /** - * Payload type of the encoded payload - */ - uint8_t PayloadType() const { return _payloadType; } - /** - * Get codec specific info. - * The returned pointer is only valid as long as the VCMEncodedFrame - * is valid. Also, VCMEncodedFrame owns the pointer and will delete - * the object. - */ - const CodecSpecificInfo* CodecSpecific() const {return &_codecSpecificInfo;} - - const RTPFragmentationHeader* FragmentationHeader() const; - -protected: - /** - * Verifies that current allocated buffer size is larger than or equal to the input size. - * If the current buffer size is smaller, a new allocation is made and the old buffer data - * is copied to the new buffer. - * Buffer size is updated to minimumSize. - */ - void VerifyAndAllocate(size_t minimumSize); - - void Reset(); - - void CopyCodecSpecific(const RTPVideoHeader* header); - - int64_t _renderTimeMs; - uint8_t _payloadType; - bool _missingFrame; - CodecSpecificInfo _codecSpecificInfo; - webrtc::VideoCodecType _codec; - RTPFragmentationHeader _fragmentation; - VideoRotation _rotation; - - // Video rotation is only set along with the last packet for each frame - // (same as marker bit). This |_rotation_set| is only for debugging purpose - // to ensure we don't set it twice for a frame. - bool _rotation_set; -}; - -} // namespace webrtc - -#endif // WEBRTC_MODULES_VIDEO_CODING_ENCODED_FRAME_H_