Refactoring codec_database.cc/.h to Google style.
BUG= Review URL: https://webrtc-codereview.appspot.com/857009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2906 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
10a15badcc
commit
fa7e8682c3
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_
|
#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_CODEC_DATABASE_H_
|
||||||
#define WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_
|
#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_CODEC_DATABASE_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -17,194 +17,184 @@
|
|||||||
#include "modules/video_coding/main/interface/video_coding.h"
|
#include "modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "modules/video_coding/main/source/generic_decoder.h"
|
#include "modules/video_coding/main/source/generic_decoder.h"
|
||||||
#include "modules/video_coding/main/source/generic_encoder.h"
|
#include "modules/video_coding/main/source/generic_encoder.h"
|
||||||
|
#include "system_wrappers/interface/scoped_ptr.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc {
|
||||||
{
|
|
||||||
|
|
||||||
enum VCMCodecDBProperties
|
enum VCMCodecDBProperties {
|
||||||
{
|
kDefaultPayloadSize = 1440
|
||||||
kDefaultPayloadSize = 1440
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCMDecoderMapItem {
|
struct VCMDecoderMapItem {
|
||||||
public:
|
public:
|
||||||
VCMDecoderMapItem(VideoCodec* settings,
|
VCMDecoderMapItem(VideoCodec* settings,
|
||||||
WebRtc_UWord32 numberOfCores,
|
int number_of_cores,
|
||||||
bool requireKeyFrame);
|
bool require_key_frame);
|
||||||
|
|
||||||
VideoCodec* _settings;
|
scoped_ptr<VideoCodec> settings;
|
||||||
WebRtc_UWord32 _numberOfCores;
|
int number_of_cores;
|
||||||
bool _requireKeyFrame;
|
bool require_key_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCMExtDecoderMapItem {
|
struct VCMExtDecoderMapItem {
|
||||||
public:
|
public:
|
||||||
VCMExtDecoderMapItem(VideoDecoder* externalDecoderInstance,
|
VCMExtDecoderMapItem(VideoDecoder* external_decoder_instance,
|
||||||
WebRtc_UWord8 payloadType,
|
uint8_t payload_type,
|
||||||
bool internalRenderTiming);
|
bool internal_render_timing);
|
||||||
|
|
||||||
WebRtc_UWord8 _payloadType;
|
uint8_t payload_type;
|
||||||
VideoDecoder* _externalDecoderInstance;
|
VideoDecoder* external_decoder_instance;
|
||||||
bool _internalRenderTiming;
|
bool internal_render_timing;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*******************************/
|
class VCMCodecDataBase {
|
||||||
/* VCMCodecDataBase class */
|
public:
|
||||||
/*******************************/
|
explicit VCMCodecDataBase(int id);
|
||||||
class VCMCodecDataBase
|
~VCMCodecDataBase();
|
||||||
{
|
|
||||||
public:
|
|
||||||
VCMCodecDataBase(WebRtc_Word32 id);
|
|
||||||
~VCMCodecDataBase();
|
|
||||||
/**
|
|
||||||
* Release codecdatabase - release all memory for both send and receive side
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 Reset();
|
|
||||||
/**
|
|
||||||
* Sender Side
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Returns the number of supported codecs (or -1 in case of error).
|
|
||||||
*/
|
|
||||||
static WebRtc_UWord8 NumberOfCodecs();
|
|
||||||
/**
|
|
||||||
* Get supported codecs with ID
|
|
||||||
* Input Values:
|
|
||||||
* listnr : Requested codec id number
|
|
||||||
* codec_inst: Pointer to the struct in which the returned codec information is copied
|
|
||||||
* Return Values: 0 if successful, otherwise
|
|
||||||
*/
|
|
||||||
static WebRtc_Word32 Codec(WebRtc_UWord8 listId, VideoCodec* settings);
|
|
||||||
static WebRtc_Word32 Codec(VideoCodecType codecType, VideoCodec* settings);
|
|
||||||
/**
|
|
||||||
* Reset Sender side
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 ResetSender();
|
|
||||||
/**
|
|
||||||
* Setting the sender side codec and initiaiting the desired codec given the VideoCodec
|
|
||||||
* struct.
|
|
||||||
* Return Value: 0 if the codec and the settings are supported, otherwise
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 RegisterSendCodec(const VideoCodec* sendCodec,
|
|
||||||
WebRtc_UWord32 numberOfCores,
|
|
||||||
WebRtc_UWord32 maxPayloadSize);
|
|
||||||
/**
|
|
||||||
* Get current send side codec. Relevant for internal codecs only.
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 SendCodec(VideoCodec* currentSendCodec) const;
|
|
||||||
/**
|
|
||||||
* Get current send side codec type. Relevant for internal codecs only.
|
|
||||||
*/
|
|
||||||
VideoCodecType SendCodec() const;
|
|
||||||
/**
|
|
||||||
* Register external encoder - current assumption - if one is registered then it will also
|
|
||||||
* be used, and therefore it is also initialized
|
|
||||||
* Return value: A pointer to the encoder on success, or null, in case of an error.
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 DeRegisterExternalEncoder(WebRtc_UWord8 payloadType, bool& wasSendCodec);
|
|
||||||
WebRtc_Word32 RegisterExternalEncoder(VideoEncoder* externalEncoder,
|
|
||||||
WebRtc_UWord8 payloadType,
|
|
||||||
bool internalSource);
|
|
||||||
/**
|
|
||||||
* Returns a encoder given a payloadname - to be used with internal encoders only.
|
|
||||||
* Special cases:
|
|
||||||
* Encoder exists - If payload matches, returns existing one, otherwise,
|
|
||||||
* deletes existing one and creates new one.
|
|
||||||
* No match found / Error - returns NULL.
|
|
||||||
*/
|
|
||||||
VCMGenericEncoder* SetEncoder(const VideoCodec* settings,
|
|
||||||
VCMEncodedFrameCallback* VCMencodedFrameCallback);
|
|
||||||
|
|
||||||
WebRtc_Word32 SetPeriodicKeyFrames(bool enable);
|
// Sender Side
|
||||||
|
// Returns the number of supported codecs (or -1 in case of error).
|
||||||
|
static int NumberOfCodecs();
|
||||||
|
|
||||||
bool InternalSource() const;
|
// Returns the default settings for the codec with id |list_id|.
|
||||||
|
static bool Codec(int list_id, VideoCodec* settings);
|
||||||
|
|
||||||
/*
|
// Returns the default settings for the codec with type |codec_type|.
|
||||||
* Receiver Side
|
static bool Codec(VideoCodecType codec_type, VideoCodec* settings);
|
||||||
*/
|
|
||||||
WebRtc_Word32 ResetReceiver();
|
|
||||||
/**
|
|
||||||
* Register external decoder/render object
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 DeRegisterExternalDecoder(WebRtc_UWord8 payloadType);
|
|
||||||
WebRtc_Word32 RegisterExternalDecoder(VideoDecoder* externalDecoder,
|
|
||||||
WebRtc_UWord8 payloadType,
|
|
||||||
bool internalRenderTiming);
|
|
||||||
|
|
||||||
bool DecoderRegistered() const;
|
void ResetSender();
|
||||||
/**
|
|
||||||
* Register recieve codec
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 RegisterReceiveCodec(const VideoCodec* receiveCodec,
|
|
||||||
WebRtc_UWord32 numberOfCores,
|
|
||||||
bool requireKeyFrame);
|
|
||||||
WebRtc_Word32 DeRegisterReceiveCodec(WebRtc_UWord8 payloadType);
|
|
||||||
/**
|
|
||||||
* Get current receive side codec. Relevant for internal codecs only.
|
|
||||||
*/
|
|
||||||
WebRtc_Word32 ReceiveCodec(VideoCodec* currentReceiveCodec) const;
|
|
||||||
/**
|
|
||||||
* Get current receive side codec type. Relevant for internal codecs only.
|
|
||||||
*/
|
|
||||||
VideoCodecType ReceiveCodec() const;
|
|
||||||
/**
|
|
||||||
* Returns a decoder given which matches a payload type.
|
|
||||||
* Special cases:
|
|
||||||
* Decoder exists - If payload matches, returns existing one, otherwise, deletes
|
|
||||||
* existing one, and creates new one.
|
|
||||||
* No match found / Error - returns NULL.
|
|
||||||
*/
|
|
||||||
VCMGenericDecoder* SetDecoder(WebRtc_UWord8 payloadType, VCMDecodedFrameCallback& callback);
|
|
||||||
|
|
||||||
VCMGenericDecoder* CreateAndInitDecoder(WebRtc_UWord8 payloadType,
|
// Sets the sender side codec and initiates the desired codec given the
|
||||||
VideoCodec& newCodec,
|
// VideoCodec struct.
|
||||||
bool &external) const;
|
// Returns true if the codec was successfully registered, false otherwise.
|
||||||
|
bool RegisterSendCodec(const VideoCodec* send_codec,
|
||||||
|
int number_of_cores,
|
||||||
|
int max_payload_size);
|
||||||
|
|
||||||
VCMGenericDecoder* CreateDecoderCopy() const;
|
// Gets the current send codec. Relevant for internal codecs only.
|
||||||
|
// Returns true if there is a send codec, false otherwise.
|
||||||
|
bool SendCodec(VideoCodec* current_send_codec) const;
|
||||||
|
|
||||||
void ReleaseDecoder(VCMGenericDecoder* decoder) const;
|
// Gets current send side codec type. Relevant for internal codecs only.
|
||||||
|
// Returns kVideoCodecUnknown if there is no send codec.
|
||||||
|
VideoCodecType SendCodec() const;
|
||||||
|
|
||||||
void CopyDecoder(const VCMGenericDecoder& decoder);
|
// Registers and initializes an external encoder object.
|
||||||
|
// |internal_source| should be set to true if the codec has an internal
|
||||||
|
// video source and doesn't need the user to provide it with frames via
|
||||||
|
// the Encode() method.
|
||||||
|
void RegisterExternalEncoder(VideoEncoder* external_encoder,
|
||||||
|
uint8_t payload_type,
|
||||||
|
bool internal_source);
|
||||||
|
|
||||||
bool RenderTiming() const;
|
// Deregisters an external encoder. Returns true if the encoder was
|
||||||
|
// found and deregistered, false otherwise. |was_send_codec| is set to true
|
||||||
|
// if the external encoder was the send codec before being deregistered.
|
||||||
|
bool DeregisterExternalEncoder(uint8_t payload_type, bool* was_send_codec);
|
||||||
|
|
||||||
protected:
|
// Returns an encoder specified by the payload type in |settings|. The
|
||||||
/**
|
// encoded frame callback of the encoder is set to |encoded_frame_callback|.
|
||||||
* Create an internal Encoder given a codec type
|
// If no such encoder already exists an instance will be created and
|
||||||
*/
|
// initialized using |settings|.
|
||||||
VCMGenericEncoder* CreateEncoder(const VideoCodecType type) const;
|
// NULL is returned if no encoder with the specified payload type was found
|
||||||
|
// and the function failed to create one.
|
||||||
|
VCMGenericEncoder* GetEncoder(
|
||||||
|
const VideoCodec* settings,
|
||||||
|
VCMEncodedFrameCallback* encoded_frame_callback);
|
||||||
|
|
||||||
void DeleteEncoder();
|
bool SetPeriodicKeyFrames(bool enable);
|
||||||
/*
|
|
||||||
* Create an internal Decoder given a codec type
|
|
||||||
*/
|
|
||||||
VCMGenericDecoder* CreateDecoder(VideoCodecType type) const;
|
|
||||||
|
|
||||||
VCMDecoderMapItem* FindDecoderItem(WebRtc_UWord8 payloadType) const;
|
// Receiver Side
|
||||||
|
void ResetReceiver();
|
||||||
|
|
||||||
VCMExtDecoderMapItem* FindExternalDecoderItem(WebRtc_UWord8 payloadType) const;
|
// Deregisters an external decoder object specified by |payload_type|.
|
||||||
|
bool DeregisterExternalDecoder(uint8_t payload_type);
|
||||||
|
|
||||||
private:
|
// Registers an external decoder object to the payload type |payload_type|.
|
||||||
typedef std::map<uint8_t, VCMDecoderMapItem*> DecoderMap;
|
// |internal_render_timing| is set to true if the |external_decoder| has
|
||||||
typedef std::map<uint8_t, VCMExtDecoderMapItem*> ExternalDecoderMap;
|
// built in rendering which is able to obey the render timestamps of the
|
||||||
WebRtc_Word32 _id;
|
// encoded frames.
|
||||||
WebRtc_UWord32 _numberOfCores;
|
bool RegisterExternalDecoder(VideoDecoder* external_decoder,
|
||||||
WebRtc_UWord32 _maxPayloadSize;
|
uint8_t payload_type,
|
||||||
bool _periodicKeyFrames;
|
bool internal_render_timing);
|
||||||
bool _currentEncIsExternal;
|
|
||||||
VideoCodec _sendCodec;
|
|
||||||
VideoCodec _receiveCodec;
|
|
||||||
WebRtc_UWord8 _externalPayloadType;
|
|
||||||
VideoEncoder* _externalEncoder;
|
|
||||||
bool _internalSource;
|
|
||||||
VCMGenericEncoder* _ptrEncoder;
|
|
||||||
VCMGenericDecoder* _ptrDecoder;
|
|
||||||
bool _currentDecIsExternal;
|
|
||||||
DecoderMap _decMap;
|
|
||||||
ExternalDecoderMap _decExternalMap;
|
|
||||||
}; // end of VCMCodecDataBase class definition
|
|
||||||
|
|
||||||
} // namespace webrtc
|
bool DecoderRegistered() const;
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_
|
bool RegisterReceiveCodec(const VideoCodec* receive_codec,
|
||||||
|
int number_of_cores,
|
||||||
|
bool require_key_frame);
|
||||||
|
|
||||||
|
bool DeregisterReceiveCodec(uint8_t payload_type);
|
||||||
|
|
||||||
|
// Get current receive side codec. Relevant for internal codecs only.
|
||||||
|
bool ReceiveCodec(VideoCodec* current_receive_codec) const;
|
||||||
|
|
||||||
|
// Get current receive side codec type. Relevant for internal codecs only.
|
||||||
|
VideoCodecType ReceiveCodec() const;
|
||||||
|
|
||||||
|
// Returns a decoder specified by |payload_type|. The decoded frame callback
|
||||||
|
// of the encoder is set to |decoded_frame_callback|. If no such decoder
|
||||||
|
// already exists an instance will be created and initialized.
|
||||||
|
// NULL is returned if no encoder with the specified payload type was found
|
||||||
|
// and the function failed to create one.
|
||||||
|
VCMGenericDecoder* GetDecoder(
|
||||||
|
uint8_t payload_type, VCMDecodedFrameCallback* decoded_frame_callback);
|
||||||
|
|
||||||
|
// Returns a deep copy of the currently active decoder.
|
||||||
|
VCMGenericDecoder* CreateDecoderCopy() const;
|
||||||
|
|
||||||
|
// Deletes the memory of the decoder instance |decoder|. Used to delete
|
||||||
|
// deep copies returned by CreateDecoderCopy().
|
||||||
|
void ReleaseDecoder(VCMGenericDecoder* decoder) const;
|
||||||
|
|
||||||
|
// Creates a deep copy of |decoder| and replaces the currently used decoder
|
||||||
|
// with it.
|
||||||
|
void CopyDecoder(const VCMGenericDecoder& decoder);
|
||||||
|
|
||||||
|
// Returns true if the currently active decoder supports render scheduling,
|
||||||
|
// that is, it is able to render frames according to the render timestamp of
|
||||||
|
// the encoded frames.
|
||||||
|
bool SupportsRenderScheduling() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef std::map<uint8_t, VCMDecoderMapItem*> DecoderMap;
|
||||||
|
typedef std::map<uint8_t, VCMExtDecoderMapItem*> ExternalDecoderMap;
|
||||||
|
|
||||||
|
VCMGenericDecoder* CreateAndInitDecoder(uint8_t payload_type,
|
||||||
|
VideoCodec* new_codec,
|
||||||
|
bool* external) const;
|
||||||
|
|
||||||
|
// Create an internal encoder given a codec type.
|
||||||
|
VCMGenericEncoder* CreateEncoder(const VideoCodecType type) const;
|
||||||
|
|
||||||
|
void DeleteEncoder();
|
||||||
|
|
||||||
|
// Create an internal Decoder given a codec type
|
||||||
|
VCMGenericDecoder* CreateDecoder(VideoCodecType type) const;
|
||||||
|
|
||||||
|
const VCMDecoderMapItem* FindDecoderItem(uint8_t payload_type) const;
|
||||||
|
|
||||||
|
const VCMExtDecoderMapItem* FindExternalDecoderItem(
|
||||||
|
uint8_t payload_type) const;
|
||||||
|
|
||||||
|
int id_;
|
||||||
|
int number_of_cores_;
|
||||||
|
int max_payload_size_;
|
||||||
|
bool periodic_key_frames_;
|
||||||
|
bool current_enc_is_external_;
|
||||||
|
VideoCodec send_codec_;
|
||||||
|
VideoCodec receive_codec_;
|
||||||
|
uint8_t external_payload_type_;
|
||||||
|
VideoEncoder* external_encoder_;
|
||||||
|
bool internal_source_;
|
||||||
|
VCMGenericEncoder* ptr_encoder_;
|
||||||
|
VCMGenericDecoder* ptr_decoder_;
|
||||||
|
bool current_dec_is_external_;
|
||||||
|
DecoderMap dec_map_;
|
||||||
|
ExternalDecoderMap dec_external_map_;
|
||||||
|
}; // VCMCodecDataBase
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_CODEC_DATABASE_H_
|
||||||
|
@ -271,7 +271,7 @@ VideoCodingModule::Codec(WebRtc_UWord8 listId, VideoCodec* codec)
|
|||||||
{
|
{
|
||||||
return VCM_PARAMETER_ERROR;
|
return VCM_PARAMETER_ERROR;
|
||||||
}
|
}
|
||||||
return VCMCodecDataBase::Codec(listId, codec);
|
return VCMCodecDataBase::Codec(listId, codec) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get supported codec with type
|
// Get supported codec with type
|
||||||
@ -282,7 +282,7 @@ VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec)
|
|||||||
{
|
{
|
||||||
return VCM_PARAMETER_ERROR;
|
return VCM_PARAMETER_ERROR;
|
||||||
}
|
}
|
||||||
return VCMCodecDataBase::Codec(codecType, codec);
|
return VCMCodecDataBase::Codec(codecType, codec) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -314,15 +314,14 @@ VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec,
|
|||||||
{
|
{
|
||||||
return VCM_PARAMETER_ERROR;
|
return VCM_PARAMETER_ERROR;
|
||||||
}
|
}
|
||||||
WebRtc_Word32 ret = _codecDataBase.RegisterSendCodec(sendCodec,
|
bool ret = _codecDataBase.RegisterSendCodec(sendCodec, numberOfCores,
|
||||||
numberOfCores,
|
maxPayloadSize);
|
||||||
maxPayloadSize);
|
if (!ret)
|
||||||
if (ret < 0)
|
|
||||||
{
|
{
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_encoder = _codecDataBase.SetEncoder(sendCodec, &_encodedFrameCallback);
|
_encoder = _codecDataBase.GetEncoder(sendCodec, &_encodedFrameCallback);
|
||||||
if (_encoder == NULL)
|
if (_encoder == NULL)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError,
|
WEBRTC_TRACE(webrtc::kTraceError,
|
||||||
@ -384,19 +383,18 @@ VideoCodingModuleImpl::RegisterExternalEncoder(VideoEncoder* externalEncoder,
|
|||||||
if (externalEncoder == NULL)
|
if (externalEncoder == NULL)
|
||||||
{
|
{
|
||||||
bool wasSendCodec = false;
|
bool wasSendCodec = false;
|
||||||
const WebRtc_Word32 ret = _codecDataBase.DeRegisterExternalEncoder(
|
const bool ret = _codecDataBase.DeregisterExternalEncoder(
|
||||||
payloadType,
|
payloadType, &wasSendCodec);
|
||||||
wasSendCodec);
|
|
||||||
if (wasSendCodec)
|
if (wasSendCodec)
|
||||||
{
|
{
|
||||||
// Make sure the VCM doesn't use the de-registered codec
|
// Make sure the VCM doesn't use the de-registered codec
|
||||||
_encoder = NULL;
|
_encoder = NULL;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret ? 0 : -1;
|
||||||
}
|
}
|
||||||
return _codecDataBase.RegisterExternalEncoder(externalEncoder,
|
_codecDataBase.RegisterExternalEncoder(externalEncoder, payloadType,
|
||||||
payloadType,
|
internalSource);
|
||||||
internalSource);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get codec config parameters
|
// Get codec config parameters
|
||||||
@ -802,14 +800,10 @@ VideoCodingModuleImpl::RegisterExternalDecoder(VideoDecoder* externalDecoder,
|
|||||||
{
|
{
|
||||||
// Make sure the VCM updates the decoder next time it decodes.
|
// Make sure the VCM updates the decoder next time it decodes.
|
||||||
_decoder = NULL;
|
_decoder = NULL;
|
||||||
return _codecDataBase.DeRegisterExternalDecoder(payloadType);
|
return _codecDataBase.DeregisterExternalDecoder(payloadType) ? 0 : -1;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _codecDataBase.RegisterExternalDecoder(externalDecoder,
|
|
||||||
payloadType,
|
|
||||||
internalRenderTiming);
|
|
||||||
}
|
}
|
||||||
|
return _codecDataBase.RegisterExternalDecoder(
|
||||||
|
externalDecoder, payloadType, internalRenderTiming) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register a frame type request callback.
|
// Register a frame type request callback.
|
||||||
@ -863,10 +857,10 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs)
|
|||||||
_dualReceiver.NackMode() == kNackInfinite);
|
_dualReceiver.NackMode() == kNackInfinite);
|
||||||
|
|
||||||
VCMEncodedFrame* frame = _receiver.FrameForDecoding(
|
VCMEncodedFrame* frame = _receiver.FrameForDecoding(
|
||||||
maxWaitTimeMs,
|
maxWaitTimeMs,
|
||||||
nextRenderTimeMs,
|
nextRenderTimeMs,
|
||||||
_codecDataBase.RenderTiming(),
|
_codecDataBase.SupportsRenderScheduling(),
|
||||||
&_dualReceiver);
|
&_dualReceiver);
|
||||||
|
|
||||||
if (dualReceiverEnabledNotReceiving && _dualReceiver.State() == kReceiving)
|
if (dualReceiverEnabledNotReceiving && _dualReceiver.State() == kReceiving)
|
||||||
{
|
{
|
||||||
@ -1045,10 +1039,10 @@ WebRtc_Word32
|
|||||||
VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
|
VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
|
||||||
{
|
{
|
||||||
// Change decoder if payload type has changed
|
// Change decoder if payload type has changed
|
||||||
const bool renderTimingBefore = _codecDataBase.RenderTiming();
|
const bool renderTimingBefore = _codecDataBase.SupportsRenderScheduling();
|
||||||
_decoder = _codecDataBase.SetDecoder(frame.PayloadType(),
|
_decoder = _codecDataBase.GetDecoder(frame.PayloadType(),
|
||||||
_decodedFrameCallback);
|
&_decodedFrameCallback);
|
||||||
if (renderTimingBefore != _codecDataBase.RenderTiming())
|
if (renderTimingBefore != _codecDataBase.SupportsRenderScheduling())
|
||||||
{
|
{
|
||||||
// Make sure we reset the decode time estimate since it will
|
// Make sure we reset the decode time estimate since it will
|
||||||
// be zero for codecs without render timing.
|
// be zero for codecs without render timing.
|
||||||
@ -1157,8 +1151,11 @@ VideoCodingModuleImpl::RegisterReceiveCodec(const VideoCodec* receiveCodec,
|
|||||||
{
|
{
|
||||||
return VCM_PARAMETER_ERROR;
|
return VCM_PARAMETER_ERROR;
|
||||||
}
|
}
|
||||||
return _codecDataBase.RegisterReceiveCodec(receiveCodec, numberOfCores,
|
if (!_codecDataBase.RegisterReceiveCodec(receiveCodec, numberOfCores,
|
||||||
requireKeyFrame);
|
requireKeyFrame)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current received codec
|
// Get current received codec
|
||||||
|
@ -125,8 +125,9 @@ CodecDataBaseTest::Perform(CmdArgs& args)
|
|||||||
sourceFrame.SetTimeStamp(_timeStamp);
|
sourceFrame.SetTimeStamp(_timeStamp);
|
||||||
// Encoder registration
|
// Encoder registration
|
||||||
TEST (VideoCodingModule::NumberOfCodecs() > 0);
|
TEST (VideoCodingModule::NumberOfCodecs() > 0);
|
||||||
TEST(VideoCodingModule::Codec(-1, &sendCodec) == VCM_PARAMETER_ERROR);
|
TEST(VideoCodingModule::Codec(-1, &sendCodec) < 0);
|
||||||
TEST(VideoCodingModule::Codec(VideoCodingModule::NumberOfCodecs() + 1, &sendCodec) == VCM_PARAMETER_ERROR);
|
TEST(VideoCodingModule::Codec(VideoCodingModule::NumberOfCodecs() + 1,
|
||||||
|
&sendCodec) < 0);
|
||||||
VideoCodingModule::Codec(1, &sendCodec);
|
VideoCodingModule::Codec(1, &sendCodec);
|
||||||
sendCodec.plType = 0; // random value
|
sendCodec.plType = 0; // random value
|
||||||
TEST(_vcm->RegisterSendCodec(&sendCodec, 1, 1440) < 0);
|
TEST(_vcm->RegisterSendCodec(&sendCodec, 1, 1440) < 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user