WebRtc_Word32 => int32_t in video_coding/
BUG=314 Review URL: https://webrtc-codereview.appspot.com/1203008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3778 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2f44673d66
commit
034f004a4f
@ -21,66 +21,56 @@ namespace webrtc {
|
|||||||
|
|
||||||
class MockEncodedImageCallback : public EncodedImageCallback {
|
class MockEncodedImageCallback : public EncodedImageCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD3(Encoded,
|
MOCK_METHOD3(Encoded, int32_t(EncodedImage& encodedImage,
|
||||||
WebRtc_Word32(EncodedImage& encodedImage,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
const CodecSpecificInfo* codecSpecificInfo,
|
const RTPFragmentationHeader* fragmentation));
|
||||||
const RTPFragmentationHeader* fragmentation));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockVideoEncoder : public VideoEncoder {
|
class MockVideoEncoder : public VideoEncoder {
|
||||||
public:
|
public:
|
||||||
MOCK_CONST_METHOD2(Version,
|
MOCK_CONST_METHOD2(Version, int32_t(int8_t *version, int32_t length));
|
||||||
WebRtc_Word32(WebRtc_Word8 *version,
|
MOCK_METHOD3(InitEncode, int32_t(const VideoCodec* codecSettings,
|
||||||
WebRtc_Word32 length));
|
int32_t numberOfCores,
|
||||||
MOCK_METHOD3(InitEncode,
|
uint32_t maxPayloadSize));
|
||||||
WebRtc_Word32(const VideoCodec* codecSettings,
|
MOCK_METHOD3(Encode, int32_t(const I420VideoFrame& inputImage,
|
||||||
WebRtc_Word32 numberOfCores,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
WebRtc_UWord32 maxPayloadSize));
|
const std::vector<VideoFrameType>* frame_types));
|
||||||
MOCK_METHOD3(Encode,
|
|
||||||
WebRtc_Word32(const I420VideoFrame& inputImage,
|
|
||||||
const CodecSpecificInfo* codecSpecificInfo,
|
|
||||||
const std::vector<VideoFrameType>* frame_types));
|
|
||||||
MOCK_METHOD1(RegisterEncodeCompleteCallback,
|
MOCK_METHOD1(RegisterEncodeCompleteCallback,
|
||||||
WebRtc_Word32(EncodedImageCallback* callback));
|
int32_t(EncodedImageCallback* callback));
|
||||||
MOCK_METHOD0(Release, WebRtc_Word32());
|
MOCK_METHOD0(Release, int32_t());
|
||||||
MOCK_METHOD0(Reset, WebRtc_Word32());
|
MOCK_METHOD0(Reset, int32_t());
|
||||||
MOCK_METHOD2(SetChannelParameters, WebRtc_Word32(WebRtc_UWord32 packetLoss,
|
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int rtt));
|
||||||
int rtt));
|
MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
|
||||||
MOCK_METHOD2(SetRates,
|
MOCK_METHOD1(SetPeriodicKeyFrames, int32_t(bool enable));
|
||||||
WebRtc_Word32(WebRtc_UWord32 newBitRate,
|
|
||||||
WebRtc_UWord32 frameRate));
|
|
||||||
MOCK_METHOD1(SetPeriodicKeyFrames, WebRtc_Word32(bool enable));
|
|
||||||
MOCK_METHOD2(CodecConfigParameters,
|
MOCK_METHOD2(CodecConfigParameters,
|
||||||
WebRtc_Word32(WebRtc_UWord8* /*buffer*/, WebRtc_Word32));
|
int32_t(uint8_t* /*buffer*/, int32_t));
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockDecodedImageCallback : public DecodedImageCallback {
|
class MockDecodedImageCallback : public DecodedImageCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(Decoded,
|
MOCK_METHOD1(Decoded,
|
||||||
WebRtc_Word32(I420VideoFrame& decodedImage));
|
int32_t(I420VideoFrame& decodedImage));
|
||||||
MOCK_METHOD1(ReceivedDecodedReferenceFrame,
|
MOCK_METHOD1(ReceivedDecodedReferenceFrame,
|
||||||
WebRtc_Word32(const WebRtc_UWord64 pictureId));
|
int32_t(const uint64_t pictureId));
|
||||||
MOCK_METHOD1(ReceivedDecodedFrame,
|
MOCK_METHOD1(ReceivedDecodedFrame,
|
||||||
WebRtc_Word32(const WebRtc_UWord64 pictureId));
|
int32_t(const uint64_t pictureId));
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockVideoDecoder : public VideoDecoder {
|
class MockVideoDecoder : public VideoDecoder {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD2(InitDecode,
|
MOCK_METHOD2(InitDecode, int32_t(const VideoCodec* codecSettings,
|
||||||
WebRtc_Word32(const VideoCodec* codecSettings,
|
int32_t numberOfCores));
|
||||||
WebRtc_Word32 numberOfCores));
|
MOCK_METHOD5(Decode, int32_t(const EncodedImage& inputImage,
|
||||||
MOCK_METHOD5(Decode,
|
bool missingFrames,
|
||||||
WebRtc_Word32(const EncodedImage& inputImage,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
bool missingFrames,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
int64_t renderTimeMs));
|
||||||
const CodecSpecificInfo* codecSpecificInfo,
|
|
||||||
WebRtc_Word64 renderTimeMs));
|
|
||||||
MOCK_METHOD1(RegisterDecodeCompleteCallback,
|
MOCK_METHOD1(RegisterDecodeCompleteCallback,
|
||||||
WebRtc_Word32(DecodedImageCallback* callback));
|
int32_t(DecodedImageCallback* callback));
|
||||||
MOCK_METHOD0(Release, WebRtc_Word32());
|
MOCK_METHOD0(Release, int32_t());
|
||||||
MOCK_METHOD0(Reset, WebRtc_Word32());
|
MOCK_METHOD0(Reset, int32_t());
|
||||||
MOCK_METHOD2(SetCodecConfigParameters,
|
MOCK_METHOD2(SetCodecConfigParameters,
|
||||||
WebRtc_Word32(const WebRtc_UWord8* /*buffer*/, WebRtc_Word32));
|
int32_t(const uint8_t* /*buffer*/, int32_t));
|
||||||
MOCK_METHOD0(Copy, VideoDecoder*());
|
MOCK_METHOD0(Copy, VideoDecoder*());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,16 +31,16 @@ class RTPFragmentationHeader; // forward declaration
|
|||||||
struct CodecSpecificInfoVP8
|
struct CodecSpecificInfoVP8
|
||||||
{
|
{
|
||||||
bool hasReceivedSLI;
|
bool hasReceivedSLI;
|
||||||
WebRtc_UWord8 pictureIdSLI;
|
uint8_t pictureIdSLI;
|
||||||
bool hasReceivedRPSI;
|
bool hasReceivedRPSI;
|
||||||
WebRtc_UWord64 pictureIdRPSI;
|
uint64_t pictureIdRPSI;
|
||||||
WebRtc_Word16 pictureId; // negative value to skip pictureId
|
int16_t pictureId; // negative value to skip pictureId
|
||||||
bool nonReference;
|
bool nonReference;
|
||||||
WebRtc_UWord8 simulcastIdx;
|
uint8_t simulcastIdx;
|
||||||
WebRtc_UWord8 temporalIdx;
|
uint8_t temporalIdx;
|
||||||
bool layerSync;
|
bool layerSync;
|
||||||
int tl0PicIdx; // Negative value to skip tl0PicIdx
|
int tl0PicIdx; // Negative value to skip tl0PicIdx
|
||||||
WebRtc_Word8 keyIdx; // negative value to skip keyIdx
|
int8_t keyIdx; // negative value to skip keyIdx
|
||||||
};
|
};
|
||||||
|
|
||||||
union CodecSpecificInfoUnion
|
union CodecSpecificInfoUnion
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
// should be dropped to keep bit rate or frame rate.
|
// should be dropped to keep bit rate or frame rate.
|
||||||
// = 0, if OK.
|
// = 0, if OK.
|
||||||
// < 0, on error.
|
// < 0, on error.
|
||||||
virtual WebRtc_Word32
|
virtual int32_t
|
||||||
Encoded(EncodedImage& encodedImage,
|
Encoded(EncodedImage& encodedImage,
|
||||||
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
||||||
const RTPFragmentationHeader* fragmentation = NULL) = 0;
|
const RTPFragmentationHeader* fragmentation = NULL) = 0;
|
||||||
@ -91,7 +91,7 @@ public:
|
|||||||
// to have. Usually MTU - overhead.
|
// to have. Usually MTU - overhead.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 InitEncode(const VideoCodec* codecSettings, WebRtc_Word32 numberOfCores, WebRtc_UWord32 maxPayloadSize) = 0;
|
virtual int32_t InitEncode(const VideoCodec* codecSettings, int32_t numberOfCores, uint32_t maxPayloadSize) = 0;
|
||||||
|
|
||||||
// Encode an I420 image (as a part of a video stream). The encoded image
|
// Encode an I420 image (as a part of a video stream). The encoded image
|
||||||
// will be returned to the user through the encode complete callback.
|
// will be returned to the user through the encode complete callback.
|
||||||
@ -103,7 +103,7 @@ public:
|
|||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0
|
||||||
// otherwise.
|
// otherwise.
|
||||||
virtual WebRtc_Word32 Encode(
|
virtual int32_t Encode(
|
||||||
const I420VideoFrame& inputImage,
|
const I420VideoFrame& inputImage,
|
||||||
const CodecSpecificInfo* codecSpecificInfo,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
const std::vector<VideoFrameType>* frame_types) = 0;
|
const std::vector<VideoFrameType>* frame_types) = 0;
|
||||||
@ -114,12 +114,12 @@ public:
|
|||||||
// - callback : Callback object which handles encoded images.
|
// - callback : Callback object which handles encoded images.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 RegisterEncodeCompleteCallback(EncodedImageCallback* callback) = 0;
|
virtual int32_t RegisterEncodeCompleteCallback(EncodedImageCallback* callback) = 0;
|
||||||
|
|
||||||
// Free encoder memory.
|
// Free encoder memory.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 Release() = 0;
|
virtual int32_t Release() = 0;
|
||||||
|
|
||||||
// Inform the encoder about the packet loss and round trip time on the
|
// Inform the encoder about the packet loss and round trip time on the
|
||||||
// network used to decide the best pattern and signaling.
|
// network used to decide the best pattern and signaling.
|
||||||
@ -129,8 +129,7 @@ public:
|
|||||||
// - rtt : Round-trip time in milliseconds
|
// - rtt : Round-trip time in milliseconds
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 packetLoss,
|
virtual int32_t SetChannelParameters(uint32_t packetLoss, int rtt) = 0;
|
||||||
int rtt) = 0;
|
|
||||||
|
|
||||||
// Inform the encoder about the new target bit rate.
|
// Inform the encoder about the new target bit rate.
|
||||||
//
|
//
|
||||||
@ -138,7 +137,7 @@ public:
|
|||||||
// - frameRate : The target frame rate
|
// - frameRate : The target frame rate
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 SetRates(WebRtc_UWord32 newBitRate, WebRtc_UWord32 frameRate) = 0;
|
virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) = 0;
|
||||||
|
|
||||||
// Use this function to enable or disable periodic key frames. Can be useful for codecs
|
// Use this function to enable or disable periodic key frames. Can be useful for codecs
|
||||||
// which have other ways of stopping error propagation.
|
// which have other ways of stopping error propagation.
|
||||||
@ -146,7 +145,7 @@ public:
|
|||||||
// - enable : Enable or disable periodic key frames
|
// - enable : Enable or disable periodic key frames
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 SetPeriodicKeyFrames(bool enable) { return WEBRTC_VIDEO_CODEC_ERROR; }
|
virtual int32_t SetPeriodicKeyFrames(bool enable) { return WEBRTC_VIDEO_CODEC_ERROR; }
|
||||||
|
|
||||||
// Codec configuration data to send out-of-band, i.e. in SIP call setup
|
// Codec configuration data to send out-of-band, i.e. in SIP call setup
|
||||||
//
|
//
|
||||||
@ -155,7 +154,7 @@ public:
|
|||||||
// - size : The size of the buffer in bytes
|
// - size : The size of the buffer in bytes
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* /*buffer*/, WebRtc_Word32 /*size*/) { return WEBRTC_VIDEO_CODEC_ERROR; }
|
virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/, int32_t /*size*/) { return WEBRTC_VIDEO_CODEC_ERROR; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DecodedImageCallback
|
class DecodedImageCallback
|
||||||
@ -169,11 +168,11 @@ public:
|
|||||||
// - decodedImage : The decoded image.
|
// - decodedImage : The decoded image.
|
||||||
//
|
//
|
||||||
// Return value : 0 if OK, < 0 otherwise.
|
// Return value : 0 if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 Decoded(I420VideoFrame& decodedImage) = 0;
|
virtual int32_t Decoded(I420VideoFrame& decodedImage) = 0;
|
||||||
|
|
||||||
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId) {return -1;}
|
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {return -1;}
|
||||||
|
|
||||||
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId) {return -1;}
|
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) {return -1;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class VideoDecoder
|
class VideoDecoder
|
||||||
@ -188,7 +187,7 @@ public:
|
|||||||
// - numberOfCores : Number of cores available for the decoder
|
// - numberOfCores : Number of cores available for the decoder
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 InitDecode(const VideoCodec* codecSettings, WebRtc_Word32 numberOfCores) = 0;
|
virtual int32_t InitDecode(const VideoCodec* codecSettings, int32_t numberOfCores) = 0;
|
||||||
|
|
||||||
// Decode encoded image (as a part of a video stream). The decoded image
|
// Decode encoded image (as a part of a video stream). The decoded image
|
||||||
// will be returned to the user through the decode complete callback.
|
// will be returned to the user through the decode complete callback.
|
||||||
@ -207,12 +206,12 @@ public:
|
|||||||
// used by decoders with internal rendering.
|
// used by decoders with internal rendering.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32
|
virtual int32_t
|
||||||
Decode(const EncodedImage& inputImage,
|
Decode(const EncodedImage& inputImage,
|
||||||
bool missingFrames,
|
bool missingFrames,
|
||||||
const RTPFragmentationHeader* fragmentation,
|
const RTPFragmentationHeader* fragmentation,
|
||||||
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
const CodecSpecificInfo* codecSpecificInfo = NULL,
|
||||||
WebRtc_Word64 renderTimeMs = -1) = 0;
|
int64_t renderTimeMs = -1) = 0;
|
||||||
|
|
||||||
// Register an decode complete callback object.
|
// Register an decode complete callback object.
|
||||||
//
|
//
|
||||||
@ -220,17 +219,17 @@ public:
|
|||||||
// - callback : Callback object which handles decoded images.
|
// - callback : Callback object which handles decoded images.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 RegisterDecodeCompleteCallback(DecodedImageCallback* callback) = 0;
|
virtual int32_t RegisterDecodeCompleteCallback(DecodedImageCallback* callback) = 0;
|
||||||
|
|
||||||
// Free decoder memory.
|
// Free decoder memory.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 Release() = 0;
|
virtual int32_t Release() = 0;
|
||||||
|
|
||||||
// Reset decoder state and prepare for a new call.
|
// Reset decoder state and prepare for a new call.
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 Reset() = 0;
|
virtual int32_t Reset() = 0;
|
||||||
|
|
||||||
// Codec configuration data sent out-of-band, i.e. in SIP call setup
|
// Codec configuration data sent out-of-band, i.e. in SIP call setup
|
||||||
//
|
//
|
||||||
@ -240,7 +239,7 @@ public:
|
|||||||
// bytes
|
// bytes
|
||||||
//
|
//
|
||||||
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
|
||||||
virtual WebRtc_Word32 SetCodecConfigParameters(const WebRtc_UWord8* /*buffer*/, WebRtc_Word32 /*size*/) { return WEBRTC_VIDEO_CODEC_ERROR; }
|
virtual int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/, int32_t /*size*/) { return WEBRTC_VIDEO_CODEC_ERROR; }
|
||||||
|
|
||||||
// Create a copy of the codec and its internal state.
|
// Create a copy of the codec and its internal state.
|
||||||
//
|
//
|
||||||
|
@ -45,7 +45,7 @@ int PacketManipulatorImpl::ManipulatePackets(
|
|||||||
packet_reader_->InitializeReading(encoded_image->_buffer,
|
packet_reader_->InitializeReading(encoded_image->_buffer,
|
||||||
encoded_image->_length,
|
encoded_image->_length,
|
||||||
config_.packet_size_in_bytes);
|
config_.packet_size_in_bytes);
|
||||||
WebRtc_UWord8* packet = NULL;
|
uint8_t* packet = NULL;
|
||||||
int nbr_bytes_to_read;
|
int nbr_bytes_to_read;
|
||||||
// keep track of if we've lost any packets, since then we shall loose
|
// keep track of if we've lost any packets, since then we shall loose
|
||||||
// the remains of the current frame:
|
// the remains of the current frame:
|
||||||
|
@ -61,7 +61,7 @@ class PacketManipulatorTest: public PacketRelatedTest {
|
|||||||
void VerifyPacketLoss(int expected_nbr_packets_dropped,
|
void VerifyPacketLoss(int expected_nbr_packets_dropped,
|
||||||
int actual_nbr_packets_dropped,
|
int actual_nbr_packets_dropped,
|
||||||
int expected_packet_data_length,
|
int expected_packet_data_length,
|
||||||
WebRtc_UWord8* expected_packet_data,
|
uint8_t* expected_packet_data,
|
||||||
EncodedImage& actual_image) {
|
EncodedImage& actual_image) {
|
||||||
EXPECT_EQ(expected_nbr_packets_dropped, actual_nbr_packets_dropped);
|
EXPECT_EQ(expected_nbr_packets_dropped, actual_nbr_packets_dropped);
|
||||||
EXPECT_EQ(expected_packet_data_length, static_cast<int>(image_._length));
|
EXPECT_EQ(expected_packet_data_length, static_cast<int>(image_._length));
|
||||||
@ -121,8 +121,8 @@ TEST_F(PacketManipulatorTest, BurstDropNinePackets) {
|
|||||||
// Create a longer packet data structure (10 packets)
|
// Create a longer packet data structure (10 packets)
|
||||||
const int kNbrPackets = 10;
|
const int kNbrPackets = 10;
|
||||||
const int kDataLength = kPacketSizeInBytes * kNbrPackets;
|
const int kDataLength = kPacketSizeInBytes * kNbrPackets;
|
||||||
WebRtc_UWord8 data[kDataLength];
|
uint8_t data[kDataLength];
|
||||||
WebRtc_UWord8* data_pointer = data;
|
uint8_t* data_pointer = data;
|
||||||
// Fill with 0s, 1s and so on to be able to easily verify which were dropped:
|
// Fill with 0s, 1s and so on to be able to easily verify which were dropped:
|
||||||
for (int i = 0; i < kNbrPackets; ++i) {
|
for (int i = 0; i < kNbrPackets; ++i) {
|
||||||
memset(data_pointer + i * kPacketSizeInBytes, i, kPacketSizeInBytes);
|
memset(data_pointer + i * kPacketSizeInBytes, i, kPacketSizeInBytes);
|
||||||
|
@ -61,8 +61,8 @@ bool VideoProcessorImpl::Init() {
|
|||||||
|
|
||||||
// Initialize data structures used by the encoder/decoder APIs
|
// Initialize data structures used by the encoder/decoder APIs
|
||||||
size_t frame_length_in_bytes = frame_reader_->FrameLength();
|
size_t frame_length_in_bytes = frame_reader_->FrameLength();
|
||||||
source_buffer_ = new WebRtc_UWord8[frame_length_in_bytes];
|
source_buffer_ = new uint8_t[frame_length_in_bytes];
|
||||||
last_successful_frame_buffer_ = new WebRtc_UWord8[frame_length_in_bytes];
|
last_successful_frame_buffer_ = new uint8_t[frame_length_in_bytes];
|
||||||
// Set fixed properties common for all frames.
|
// Set fixed properties common for all frames.
|
||||||
// To keep track of spatial resize actions by encoder.
|
// To keep track of spatial resize actions by encoder.
|
||||||
last_encoder_frame_width_ = config_.codec_settings->width;
|
last_encoder_frame_width_ = config_.codec_settings->width;
|
||||||
@ -71,7 +71,7 @@ bool VideoProcessorImpl::Init() {
|
|||||||
// Setup required callbacks for the encoder/decoder:
|
// Setup required callbacks for the encoder/decoder:
|
||||||
encode_callback_ = new VideoProcessorEncodeCompleteCallback(this);
|
encode_callback_ = new VideoProcessorEncodeCompleteCallback(this);
|
||||||
decode_callback_ = new VideoProcessorDecodeCompleteCallback(this);
|
decode_callback_ = new VideoProcessorDecodeCompleteCallback(this);
|
||||||
WebRtc_Word32 register_result =
|
int32_t register_result =
|
||||||
encoder_->RegisterEncodeCompleteCallback(encode_callback_);
|
encoder_->RegisterEncodeCompleteCallback(encode_callback_);
|
||||||
if (register_result != WEBRTC_VIDEO_CODEC_OK) {
|
if (register_result != WEBRTC_VIDEO_CODEC_OK) {
|
||||||
fprintf(stderr, "Failed to register encode complete callback, return code: "
|
fprintf(stderr, "Failed to register encode complete callback, return code: "
|
||||||
@ -85,11 +85,11 @@ bool VideoProcessorImpl::Init() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Init the encoder and decoder
|
// Init the encoder and decoder
|
||||||
WebRtc_UWord32 nbr_of_cores = 1;
|
uint32_t nbr_of_cores = 1;
|
||||||
if (!config_.use_single_core) {
|
if (!config_.use_single_core) {
|
||||||
nbr_of_cores = CpuInfo::DetectNumberOfCores();
|
nbr_of_cores = CpuInfo::DetectNumberOfCores();
|
||||||
}
|
}
|
||||||
WebRtc_Word32 init_result =
|
int32_t init_result =
|
||||||
encoder_->InitEncode(config_.codec_settings, nbr_of_cores,
|
encoder_->InitEncode(config_.codec_settings, nbr_of_cores,
|
||||||
config_.networking_config.max_payload_size_in_bytes);
|
config_.networking_config.max_payload_size_in_bytes);
|
||||||
if (init_result != WEBRTC_VIDEO_CODEC_OK) {
|
if (init_result != WEBRTC_VIDEO_CODEC_OK) {
|
||||||
@ -192,8 +192,7 @@ bool VideoProcessorImpl::ProcessFrame(int frame_number) {
|
|||||||
// For dropped frames, we regard them as zero size encoded frames.
|
// For dropped frames, we regard them as zero size encoded frames.
|
||||||
encoded_frame_size_ = 0;
|
encoded_frame_size_ = 0;
|
||||||
|
|
||||||
WebRtc_Word32 encode_result = encoder_->Encode(source_frame_, NULL,
|
int32_t encode_result = encoder_->Encode(source_frame_, NULL, &frame_types);
|
||||||
&frame_types);
|
|
||||||
|
|
||||||
if (encode_result != WEBRTC_VIDEO_CODEC_OK) {
|
if (encode_result != WEBRTC_VIDEO_CODEC_OK) {
|
||||||
fprintf(stderr, "Failed to encode frame %d, return code: %d\n",
|
fprintf(stderr, "Failed to encode frame %d, return code: %d\n",
|
||||||
@ -264,8 +263,8 @@ void VideoProcessorImpl::FrameEncoded(EncodedImage* encoded_image) {
|
|||||||
decode_start_ = TickTime::Now();
|
decode_start_ = TickTime::Now();
|
||||||
// TODO(kjellander): Pass fragmentation header to the decoder when
|
// TODO(kjellander): Pass fragmentation header to the decoder when
|
||||||
// CL 172001 has been submitted and PacketManipulator supports this.
|
// CL 172001 has been submitted and PacketManipulator supports this.
|
||||||
WebRtc_Word32 decode_result = decoder_->Decode(*encoded_image,
|
int32_t decode_result = decoder_->Decode(*encoded_image, last_frame_missing_,
|
||||||
last_frame_missing_, NULL);
|
NULL);
|
||||||
stat.decode_return_code = decode_result;
|
stat.decode_return_code = decode_result;
|
||||||
if (decode_result != WEBRTC_VIDEO_CODEC_OK) {
|
if (decode_result != WEBRTC_VIDEO_CODEC_OK) {
|
||||||
// Write the last successful frame the output file to avoid getting it out
|
// Write the last successful frame the output file to avoid getting it out
|
||||||
@ -342,7 +341,7 @@ void VideoProcessorImpl::FrameDecoded(const I420VideoFrame& image) {
|
|||||||
|
|
||||||
int VideoProcessorImpl::GetElapsedTimeMicroseconds(
|
int VideoProcessorImpl::GetElapsedTimeMicroseconds(
|
||||||
const webrtc::TickTime& start, const webrtc::TickTime& stop) {
|
const webrtc::TickTime& start, const webrtc::TickTime& stop) {
|
||||||
WebRtc_UWord64 encode_time = (stop - start).Microseconds();
|
uint64_t encode_time = (stop - start).Microseconds();
|
||||||
assert(encode_time <
|
assert(encode_time <
|
||||||
static_cast<unsigned int>(std::numeric_limits<int>::max()));
|
static_cast<unsigned int>(std::numeric_limits<int>::max()));
|
||||||
return static_cast<int>(encode_time);
|
return static_cast<int>(encode_time);
|
||||||
@ -379,7 +378,7 @@ const char* VideoCodecTypeToStr(webrtc::VideoCodecType e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
|
VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
|
||||||
EncodedImage& encoded_image,
|
EncodedImage& encoded_image,
|
||||||
const webrtc::CodecSpecificInfo* codec_specific_info,
|
const webrtc::CodecSpecificInfo* codec_specific_info,
|
||||||
@ -387,7 +386,7 @@ VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
|
|||||||
video_processor_->FrameEncoded(&encoded_image); // Forward to parent class.
|
video_processor_->FrameEncoded(&encoded_image); // Forward to parent class.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded(
|
VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded(
|
||||||
I420VideoFrame& image) {
|
I420VideoFrame& image) {
|
||||||
video_processor_->FrameDecoded(image); // forward to parent class
|
video_processor_->FrameDecoded(image); // forward to parent class
|
||||||
|
@ -200,10 +200,10 @@ class VideoProcessorImpl : public VideoProcessor {
|
|||||||
EncodedImageCallback* encode_callback_;
|
EncodedImageCallback* encode_callback_;
|
||||||
DecodedImageCallback* decode_callback_;
|
DecodedImageCallback* decode_callback_;
|
||||||
// Buffer used for reading the source video file:
|
// Buffer used for reading the source video file:
|
||||||
WebRtc_UWord8* source_buffer_;
|
uint8_t* source_buffer_;
|
||||||
// Keep track of the last successful frame, since we need to write that
|
// Keep track of the last successful frame, since we need to write that
|
||||||
// when decoding fails:
|
// when decoding fails:
|
||||||
WebRtc_UWord8* last_successful_frame_buffer_;
|
uint8_t* last_successful_frame_buffer_;
|
||||||
webrtc::I420VideoFrame source_frame_;
|
webrtc::I420VideoFrame source_frame_;
|
||||||
// To keep track of if we have excluded the first key frame from packet loss:
|
// To keep track of if we have excluded the first key frame from packet loss:
|
||||||
bool first_key_frame_has_been_excluded_;
|
bool first_key_frame_has_been_excluded_;
|
||||||
@ -231,10 +231,9 @@ class VideoProcessorImpl : public VideoProcessor {
|
|||||||
explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp)
|
explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp)
|
||||||
: video_processor_(vp) {
|
: video_processor_(vp) {
|
||||||
}
|
}
|
||||||
WebRtc_Word32 Encoded(
|
int32_t Encoded(webrtc::EncodedImage& encoded_image,
|
||||||
webrtc::EncodedImage& encoded_image,
|
const webrtc::CodecSpecificInfo* codec_specific_info = NULL,
|
||||||
const webrtc::CodecSpecificInfo* codec_specific_info = NULL,
|
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
|
||||||
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VideoProcessorImpl* video_processor_;
|
VideoProcessorImpl* video_processor_;
|
||||||
@ -247,7 +246,7 @@ class VideoProcessorImpl : public VideoProcessor {
|
|||||||
explicit VideoProcessorDecodeCompleteCallback(VideoProcessorImpl* vp)
|
explicit VideoProcessorDecodeCompleteCallback(VideoProcessorImpl* vp)
|
||||||
: video_processor_(vp) {
|
: video_processor_(vp) {
|
||||||
}
|
}
|
||||||
WebRtc_Word32 Decoded(webrtc::I420VideoFrame& image);
|
int32_t Decoded(webrtc::I420VideoFrame& image);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VideoProcessorImpl* video_processor_;
|
VideoProcessorImpl* video_processor_;
|
||||||
|
@ -44,7 +44,7 @@ _waitForKey(false)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NormalAsyncTest::NormalAsyncTest(WebRtc_UWord32 bitRate)
|
NormalAsyncTest::NormalAsyncTest(uint32_t bitRate)
|
||||||
:
|
:
|
||||||
NormalTest("Async Normal Test 1", "A test of normal execution of the codec",
|
NormalTest("Async Normal Test 1", "A test of normal execution of the codec",
|
||||||
bitRate, _testNo),
|
bitRate, _testNo),
|
||||||
@ -86,7 +86,7 @@ _waitForKey(false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NormalAsyncTest::NormalAsyncTest(std::string name, std::string description,
|
NormalAsyncTest::NormalAsyncTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate, unsigned int testNo)
|
uint32_t bitRate, unsigned int testNo)
|
||||||
:
|
:
|
||||||
NormalTest(name, description, bitRate, _testNo),
|
NormalTest(name, description, bitRate, _testNo),
|
||||||
_decodeCompleteTime(0),
|
_decodeCompleteTime(0),
|
||||||
@ -107,7 +107,7 @@ _waitForKey(false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NormalAsyncTest::NormalAsyncTest(std::string name, std::string description,
|
NormalAsyncTest::NormalAsyncTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate, unsigned int testNo,
|
uint32_t bitRate, unsigned int testNo,
|
||||||
unsigned int rttFrames)
|
unsigned int rttFrames)
|
||||||
:
|
:
|
||||||
NormalTest(name, description, bitRate, _testNo),
|
NormalTest(name, description, bitRate, _testNo),
|
||||||
@ -223,12 +223,12 @@ bool FrameQueue::Empty()
|
|||||||
return _frameBufferQueue.empty();
|
return _frameBufferQueue.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32 VideoEncodeCompleteCallback::EncodedBytes()
|
uint32_t VideoEncodeCompleteCallback::EncodedBytes()
|
||||||
{
|
{
|
||||||
return _encodedBytes;
|
return _encodedBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
|
VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
|
||||||
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
||||||
const webrtc::RTPFragmentationHeader*
|
const webrtc::RTPFragmentationHeader*
|
||||||
@ -256,12 +256,12 @@ VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32 VideoDecodeCompleteCallback::DecodedBytes()
|
uint32_t VideoDecodeCompleteCallback::DecodedBytes()
|
||||||
{
|
{
|
||||||
return _decodedBytes;
|
return _decodedBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
VideoDecodeCompleteCallback::Decoded(I420VideoFrame& image)
|
VideoDecodeCompleteCallback::Decoded(I420VideoFrame& image)
|
||||||
{
|
{
|
||||||
_test.Decoded(image);
|
_test.Decoded(image);
|
||||||
@ -273,16 +273,16 @@ VideoDecodeCompleteCallback::Decoded(I420VideoFrame& image)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
VideoDecodeCompleteCallback::ReceivedDecodedReferenceFrame(
|
VideoDecodeCompleteCallback::ReceivedDecodedReferenceFrame(
|
||||||
const WebRtc_UWord64 pictureId)
|
const uint64_t pictureId)
|
||||||
{
|
{
|
||||||
return _test.ReceivedDecodedReferenceFrame(pictureId);
|
return _test.ReceivedDecodedReferenceFrame(pictureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
VideoDecodeCompleteCallback::ReceivedDecodedFrame(
|
VideoDecodeCompleteCallback::ReceivedDecodedFrame(
|
||||||
const WebRtc_UWord64 pictureId)
|
const uint64_t pictureId)
|
||||||
{
|
{
|
||||||
return _test.ReceivedDecodedFrame(pictureId);
|
return _test.ReceivedDecodedFrame(pictureId);
|
||||||
}
|
}
|
||||||
@ -511,7 +511,7 @@ NormalAsyncTest::Decode(int lossValue)
|
|||||||
// add an SLI feedback to the feedback "queue"
|
// add an SLI feedback to the feedback "queue"
|
||||||
// to be delivered to encoder with _rttFrames delay
|
// to be delivered to encoder with _rttFrames delay
|
||||||
_signalSLI.push_back(fbSignal(_rttFrames,
|
_signalSLI.push_back(fbSignal(_rttFrames,
|
||||||
static_cast<WebRtc_UWord8>((_lastDecPictureId) & 0x3f))); // 6 lsb
|
static_cast<uint8_t>((_lastDecPictureId) & 0x3f))); // 6 lsb
|
||||||
|
|
||||||
ret = WEBRTC_VIDEO_CODEC_OK;
|
ret = WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ NormalAsyncTest::Decode(int lossValue)
|
|||||||
// add an SLI feedback to the feedback "queue"
|
// add an SLI feedback to the feedback "queue"
|
||||||
// to be delivered to encoder with _rttFrames delay
|
// to be delivered to encoder with _rttFrames delay
|
||||||
_signalSLI.push_back(fbSignal(_rttFrames,
|
_signalSLI.push_back(fbSignal(_rttFrames,
|
||||||
static_cast<WebRtc_UWord8>((_lastDecPictureId + 1) & 0x3f)));//6 lsb
|
static_cast<uint8_t>((_lastDecPictureId + 1) & 0x3f)));//6 lsb
|
||||||
|
|
||||||
ret = WEBRTC_VIDEO_CODEC_OK;
|
ret = WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
@ -574,19 +574,19 @@ void NormalAsyncTest::CopyEncodedImage(VideoFrame& dest,
|
|||||||
{
|
{
|
||||||
dest.CopyFrame(src._length, src._buffer);
|
dest.CopyFrame(src._length, src._buffer);
|
||||||
//dest.SetFrameType(src._frameType);
|
//dest.SetFrameType(src._frameType);
|
||||||
dest.SetWidth((WebRtc_UWord16)src._encodedWidth);
|
dest.SetWidth((uint16_t)src._encodedWidth);
|
||||||
dest.SetHeight((WebRtc_UWord16)src._encodedHeight);
|
dest.SetHeight((uint16_t)src._encodedHeight);
|
||||||
dest.SetTimeStamp(src._timeStamp);
|
dest.SetTimeStamp(src._timeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 NormalAsyncTest::ReceivedDecodedReferenceFrame(
|
int32_t NormalAsyncTest::ReceivedDecodedReferenceFrame(
|
||||||
const WebRtc_UWord64 pictureId) {
|
const uint64_t pictureId) {
|
||||||
_lastDecRefPictureId = pictureId;
|
_lastDecRefPictureId = pictureId;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 NormalAsyncTest::ReceivedDecodedFrame(
|
int32_t NormalAsyncTest::ReceivedDecodedFrame(
|
||||||
const WebRtc_UWord64 pictureId) {
|
const uint64_t pictureId) {
|
||||||
_lastDecPictureId = pictureId;
|
_lastDecPictureId = pictureId;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -60,22 +60,22 @@ private:
|
|||||||
// feedback signal to encoder
|
// feedback signal to encoder
|
||||||
struct fbSignal
|
struct fbSignal
|
||||||
{
|
{
|
||||||
fbSignal(int d, WebRtc_UWord8 pid) : delay(d), id(pid) {};
|
fbSignal(int d, uint8_t pid) : delay(d), id(pid) {};
|
||||||
int delay;
|
int delay;
|
||||||
WebRtc_UWord8 id;
|
uint8_t id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NormalAsyncTest : public NormalTest
|
class NormalAsyncTest : public NormalTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NormalAsyncTest();
|
NormalAsyncTest();
|
||||||
NormalAsyncTest(WebRtc_UWord32 bitRate);
|
NormalAsyncTest(uint32_t bitRate);
|
||||||
NormalAsyncTest(std::string name, std::string description,
|
NormalAsyncTest(std::string name, std::string description,
|
||||||
unsigned int testNo);
|
unsigned int testNo);
|
||||||
NormalAsyncTest(std::string name, std::string description,
|
NormalAsyncTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate, unsigned int testNo);
|
uint32_t bitRate, unsigned int testNo);
|
||||||
NormalAsyncTest(std::string name, std::string description,
|
NormalAsyncTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate, unsigned int testNo,
|
uint32_t bitRate, unsigned int testNo,
|
||||||
unsigned int rttFrames);
|
unsigned int rttFrames);
|
||||||
virtual ~NormalAsyncTest() {};
|
virtual ~NormalAsyncTest() {};
|
||||||
virtual void Perform();
|
virtual void Perform();
|
||||||
@ -91,9 +91,9 @@ public:
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(
|
virtual int32_t ReceivedDecodedReferenceFrame(
|
||||||
const WebRtc_UWord64 pictureId);
|
const uint64_t pictureId);
|
||||||
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId);
|
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Setup();
|
virtual void Setup();
|
||||||
@ -106,8 +106,8 @@ protected:
|
|||||||
|
|
||||||
FILE* _sourceFile;
|
FILE* _sourceFile;
|
||||||
FILE* _decodedFile;
|
FILE* _decodedFile;
|
||||||
WebRtc_UWord32 _decodedWidth;
|
uint32_t _decodedWidth;
|
||||||
WebRtc_UWord32 _decodedHeight;
|
uint32_t _decodedHeight;
|
||||||
double _totalEncodeTime;
|
double _totalEncodeTime;
|
||||||
double _totalDecodeTime;
|
double _totalDecodeTime;
|
||||||
double _decodeCompleteTime;
|
double _decodeCompleteTime;
|
||||||
@ -122,17 +122,17 @@ protected:
|
|||||||
unsigned int _lengthEncFrame;
|
unsigned int _lengthEncFrame;
|
||||||
FrameQueueTuple* _frameToDecode;
|
FrameQueueTuple* _frameToDecode;
|
||||||
bool _appendNext;
|
bool _appendNext;
|
||||||
std::map<WebRtc_UWord32, double> _encodeTimes;
|
std::map<uint32_t, double> _encodeTimes;
|
||||||
std::map<WebRtc_UWord32, double> _decodeTimes;
|
std::map<uint32_t, double> _decodeTimes;
|
||||||
bool _missingFrames;
|
bool _missingFrames;
|
||||||
std::list<fbSignal> _signalSLI;
|
std::list<fbSignal> _signalSLI;
|
||||||
int _rttFrames;
|
int _rttFrames;
|
||||||
mutable bool _hasReceivedSLI;
|
mutable bool _hasReceivedSLI;
|
||||||
mutable bool _hasReceivedRPSI;
|
mutable bool _hasReceivedRPSI;
|
||||||
WebRtc_UWord8 _pictureIdSLI;
|
uint8_t _pictureIdSLI;
|
||||||
WebRtc_UWord16 _pictureIdRPSI;
|
uint16_t _pictureIdRPSI;
|
||||||
WebRtc_UWord64 _lastDecRefPictureId;
|
uint64_t _lastDecRefPictureId;
|
||||||
WebRtc_UWord64 _lastDecPictureId;
|
uint64_t _lastDecPictureId;
|
||||||
std::list<fbSignal> _signalPLI;
|
std::list<fbSignal> _signalPLI;
|
||||||
bool _hasReceivedPLI;
|
bool _hasReceivedPLI;
|
||||||
bool _waitForKey;
|
bool _waitForKey;
|
||||||
@ -150,16 +150,16 @@ public:
|
|||||||
_encodedBytes(0)
|
_encodedBytes(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
Encoded(webrtc::EncodedImage& encodedImage,
|
Encoded(webrtc::EncodedImage& encodedImage,
|
||||||
const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
|
const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
|
||||||
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
|
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
|
||||||
WebRtc_UWord32 EncodedBytes();
|
uint32_t EncodedBytes();
|
||||||
private:
|
private:
|
||||||
FILE* _encodedFile;
|
FILE* _encodedFile;
|
||||||
FrameQueue* _frameQueue;
|
FrameQueue* _frameQueue;
|
||||||
NormalAsyncTest& _test;
|
NormalAsyncTest& _test;
|
||||||
WebRtc_UWord32 _encodedBytes;
|
uint32_t _encodedBytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VideoDecodeCompleteCallback : public webrtc::DecodedImageCallback
|
class VideoDecodeCompleteCallback : public webrtc::DecodedImageCallback
|
||||||
@ -172,16 +172,16 @@ public:
|
|||||||
_decodedBytes(0)
|
_decodedBytes(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual WebRtc_Word32 Decoded(webrtc::I420VideoFrame& decodedImage);
|
virtual int32_t Decoded(webrtc::I420VideoFrame& decodedImage);
|
||||||
virtual WebRtc_Word32
|
virtual int32_t
|
||||||
ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId);
|
ReceivedDecodedReferenceFrame(const uint64_t pictureId);
|
||||||
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId);
|
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
|
||||||
|
|
||||||
WebRtc_UWord32 DecodedBytes();
|
uint32_t DecodedBytes();
|
||||||
private:
|
private:
|
||||||
FILE* _decodedFile;
|
FILE* _decodedFile;
|
||||||
NormalAsyncTest& _test;
|
NormalAsyncTest& _test;
|
||||||
WebRtc_UWord32 _decodedBytes;
|
uint32_t _decodedBytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_FRAMEWORK_NORMAL_ASYNC_TEST_H_
|
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_FRAMEWORK_NORMAL_ASYNC_TEST_H_
|
||||||
|
@ -39,7 +39,7 @@ _appendNext(false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NormalTest::NormalTest(std::string name, std::string description,
|
NormalTest::NormalTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate, unsigned int testNo)
|
uint32_t bitRate, unsigned int testNo)
|
||||||
:
|
:
|
||||||
CodecTest(name, description, bitRate),
|
CodecTest(name, description, bitRate),
|
||||||
_requestKeyFrame(false),
|
_requestKeyFrame(false),
|
||||||
|
@ -18,7 +18,7 @@ class NormalTest : public CodecTest
|
|||||||
public:
|
public:
|
||||||
NormalTest();
|
NormalTest();
|
||||||
NormalTest(std::string name, std::string description, unsigned int testNo);
|
NormalTest(std::string name, std::string description, unsigned int testNo);
|
||||||
NormalTest(std::string name, std::string description, WebRtc_UWord32 bitRate, unsigned int testNo);
|
NormalTest(std::string name, std::string description, uint32_t bitRate, unsigned int testNo);
|
||||||
virtual ~NormalTest() {};
|
virtual ~NormalTest() {};
|
||||||
virtual void Perform();
|
virtual void Perform();
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ PacketLossTest::Decoded(const I420VideoFrame& decodedImage)
|
|||||||
{
|
{
|
||||||
if (_lastFrame) delete [] _lastFrame;
|
if (_lastFrame) delete [] _lastFrame;
|
||||||
|
|
||||||
_lastFrame = new WebRtc_UWord8[length];
|
_lastFrame = new uint8_t[length];
|
||||||
}
|
}
|
||||||
// TODO(mikhal): Can't the last frame be a I420VideoFrame?
|
// TODO(mikhal): Can't the last frame be a I420VideoFrame?
|
||||||
ExtractBuffer(decodedImage, length, _lastFrame);
|
ExtractBuffer(decodedImage, length, _lastFrame);
|
||||||
@ -154,11 +154,11 @@ void
|
|||||||
PacketLossTest::CodecSpecific_InitBitrate()
|
PacketLossTest::CodecSpecific_InitBitrate()
|
||||||
{
|
{
|
||||||
assert(_bitRate > 0);
|
assert(_bitRate > 0);
|
||||||
WebRtc_UWord32 simulatedBitRate;
|
uint32_t simulatedBitRate;
|
||||||
if (_lossProbability != _lossRate)
|
if (_lossProbability != _lossRate)
|
||||||
{
|
{
|
||||||
// Simulating NACK
|
// Simulating NACK
|
||||||
simulatedBitRate = WebRtc_UWord32(_bitRate / (1 + _lossRate));
|
simulatedBitRate = uint32_t(_bitRate / (1 + _lossRate));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -167,7 +167,7 @@ PacketLossTest::CodecSpecific_InitBitrate()
|
|||||||
int rtt = 0;
|
int rtt = 0;
|
||||||
if (_inst.maxFramerate > 0)
|
if (_inst.maxFramerate > 0)
|
||||||
rtt = _rttFrames * (1000 / _inst.maxFramerate);
|
rtt = _rttFrames * (1000 / _inst.maxFramerate);
|
||||||
_encoder->SetChannelParameters((WebRtc_UWord32)(_lossProbability * 255.0),
|
_encoder->SetChannelParameters((uint32_t)(_lossProbability * 255.0),
|
||||||
rtt);
|
rtt);
|
||||||
_encoder->SetRates(simulatedBitRate, _inst.maxFramerate);
|
_encoder->SetRates(simulatedBitRate, _inst.maxFramerate);
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,9 @@ protected:
|
|||||||
int _totalKept;
|
int _totalKept;
|
||||||
int _totalThrown;
|
int _totalThrown;
|
||||||
int _sumChannelBytes;
|
int _sumChannelBytes;
|
||||||
std::list<WebRtc_UWord32> _frameQueue;
|
std::list<uint32_t> _frameQueue;
|
||||||
WebRtc_UWord8* _lastFrame;
|
uint8_t* _lastFrame;
|
||||||
WebRtc_UWord32 _lastFrameLength;
|
uint32_t _lastFrameLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ _description(description)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodecTest::CodecTest(std::string name, std::string description,
|
CodecTest::CodecTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate)
|
uint32_t bitRate)
|
||||||
:
|
:
|
||||||
_bitRate(bitRate),
|
_bitRate(bitRate),
|
||||||
_inname(""),
|
_inname(""),
|
||||||
@ -88,8 +88,8 @@ CodecTest::Setup()
|
|||||||
|
|
||||||
void
|
void
|
||||||
CodecTest::CodecSettings(int width, int height,
|
CodecTest::CodecSettings(int width, int height,
|
||||||
WebRtc_UWord32 frameRate /*=30*/,
|
uint32_t frameRate /*=30*/,
|
||||||
WebRtc_UWord32 bitRate /*=0*/)
|
uint32_t bitRate /*=0*/)
|
||||||
{
|
{
|
||||||
if (bitRate > 0)
|
if (bitRate > 0)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ class CodecTest
|
|||||||
public:
|
public:
|
||||||
CodecTest(std::string name, std::string description);
|
CodecTest(std::string name, std::string description);
|
||||||
CodecTest(std::string name, std::string description,
|
CodecTest(std::string name, std::string description,
|
||||||
WebRtc_UWord32 bitRate);
|
uint32_t bitRate);
|
||||||
virtual ~CodecTest() {};
|
virtual ~CodecTest() {};
|
||||||
virtual void Setup();
|
virtual void Setup();
|
||||||
virtual void Perform()=0;
|
virtual void Perform()=0;
|
||||||
@ -34,8 +34,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void CodecSettings(int width,
|
virtual void CodecSettings(int width,
|
||||||
int height,
|
int height,
|
||||||
WebRtc_UWord32 frameRate=30,
|
uint32_t frameRate=30,
|
||||||
WebRtc_UWord32 bitRate=0);
|
uint32_t bitRate=0);
|
||||||
virtual void Teardown();
|
virtual void Teardown();
|
||||||
double ActualBitRate(int nFrames);
|
double ActualBitRate(int nFrames);
|
||||||
virtual bool PacketLoss(double lossRate, int /*thrown*/);
|
virtual bool PacketLoss(double lossRate, int /*thrown*/);
|
||||||
@ -46,7 +46,7 @@ protected:
|
|||||||
|
|
||||||
webrtc::VideoEncoder* _encoder;
|
webrtc::VideoEncoder* _encoder;
|
||||||
webrtc::VideoDecoder* _decoder;
|
webrtc::VideoDecoder* _decoder;
|
||||||
WebRtc_UWord32 _bitRate;
|
uint32_t _bitRate;
|
||||||
unsigned int _lengthSourceFrame;
|
unsigned int _lengthSourceFrame;
|
||||||
unsigned char* _sourceBuffer;
|
unsigned char* _sourceBuffer;
|
||||||
webrtc::I420VideoFrame _inputVideoBuffer;
|
webrtc::I420VideoFrame _inputVideoBuffer;
|
||||||
|
@ -89,7 +89,7 @@ UnitTest::~UnitTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t
|
||||||
UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
|
UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
|
||||||
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
||||||
const webrtc::RTPFragmentationHeader*
|
const webrtc::RTPFragmentationHeader*
|
||||||
@ -101,16 +101,16 @@ UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
|
|||||||
// TODO(mikhal): Update frame type API.
|
// TODO(mikhal): Update frame type API.
|
||||||
// _encodedVideoBuffer->SetFrameType(encodedImage._frameType);
|
// _encodedVideoBuffer->SetFrameType(encodedImage._frameType);
|
||||||
_encodedVideoBuffer->SetWidth(
|
_encodedVideoBuffer->SetWidth(
|
||||||
(WebRtc_UWord16)encodedImage._encodedWidth);
|
(uint16_t)encodedImage._encodedWidth);
|
||||||
_encodedVideoBuffer->SetHeight(
|
_encodedVideoBuffer->SetHeight(
|
||||||
(WebRtc_UWord16)encodedImage._encodedHeight);
|
(uint16_t)encodedImage._encodedHeight);
|
||||||
_encodedVideoBuffer->SetTimeStamp(encodedImage._timeStamp);
|
_encodedVideoBuffer->SetTimeStamp(encodedImage._timeStamp);
|
||||||
_encodeComplete = true;
|
_encodeComplete = true;
|
||||||
_encodedFrameType = encodedImage._frameType;
|
_encodedFrameType = encodedImage._frameType;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 UnitTestDecodeCompleteCallback::Decoded(I420VideoFrame& image)
|
int32_t UnitTestDecodeCompleteCallback::Decoded(I420VideoFrame& image)
|
||||||
{
|
{
|
||||||
_decodedVideoBuffer->CopyFrame(image);
|
_decodedVideoBuffer->CopyFrame(image);
|
||||||
_decodeComplete = true;
|
_decodeComplete = true;
|
||||||
@ -145,10 +145,10 @@ UnitTestDecodeCompleteCallback::DecodeComplete()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32
|
uint32_t
|
||||||
UnitTest::WaitForEncodedFrame() const
|
UnitTest::WaitForEncodedFrame() const
|
||||||
{
|
{
|
||||||
WebRtc_Word64 startTime = TickTime::MillisecondTimestamp();
|
int64_t startTime = TickTime::MillisecondTimestamp();
|
||||||
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs)
|
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs)
|
||||||
{
|
{
|
||||||
if (_encodeCompleteCallback->EncodeComplete())
|
if (_encodeCompleteCallback->EncodeComplete())
|
||||||
@ -159,10 +159,10 @@ UnitTest::WaitForEncodedFrame() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32
|
uint32_t
|
||||||
UnitTest::WaitForDecodedFrame() const
|
UnitTest::WaitForDecodedFrame() const
|
||||||
{
|
{
|
||||||
WebRtc_Word64 startTime = TickTime::MillisecondTimestamp();
|
int64_t startTime = TickTime::MillisecondTimestamp();
|
||||||
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitDecTimeMs)
|
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitDecTimeMs)
|
||||||
{
|
{
|
||||||
if (_decodeCompleteCallback->DecodeComplete())
|
if (_decodeCompleteCallback->DecodeComplete())
|
||||||
@ -174,9 +174,9 @@ UnitTest::WaitForDecodedFrame() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32
|
uint32_t
|
||||||
UnitTest::CodecSpecific_SetBitrate(WebRtc_UWord32 bitRate,
|
UnitTest::CodecSpecific_SetBitrate(uint32_t bitRate,
|
||||||
WebRtc_UWord32 /* frameRate */)
|
uint32_t /* frameRate */)
|
||||||
{
|
{
|
||||||
return _encoder->SetRates(bitRate, _inst.maxFramerate);
|
return _encoder->SetRates(bitRate, _inst.maxFramerate);
|
||||||
}
|
}
|
||||||
@ -365,8 +365,8 @@ UnitTest::Perform()
|
|||||||
EXPECT_TRUE(_encoder->InitEncode(NULL, 1, 1440) ==
|
EXPECT_TRUE(_encoder->InitEncode(NULL, 1, 1440) ==
|
||||||
WEBRTC_VIDEO_CODEC_ERR_PARAMETER);
|
WEBRTC_VIDEO_CODEC_ERR_PARAMETER);
|
||||||
// bit rate exceeds max bit rate
|
// bit rate exceeds max bit rate
|
||||||
WebRtc_Word32 tmpBitRate = _inst.startBitrate;
|
int32_t tmpBitRate = _inst.startBitrate;
|
||||||
WebRtc_Word32 tmpMaxBitRate = _inst.maxBitrate;
|
int32_t tmpMaxBitRate = _inst.maxBitrate;
|
||||||
_inst.startBitrate = 4000;
|
_inst.startBitrate = 4000;
|
||||||
_inst.maxBitrate = 3000;
|
_inst.maxBitrate = 3000;
|
||||||
EXPECT_TRUE(_encoder->InitEncode(&_inst, 1, 1440) ==
|
EXPECT_TRUE(_encoder->InitEncode(&_inst, 1, 1440) ==
|
||||||
@ -716,7 +716,7 @@ UnitTest::RateControlTests()
|
|||||||
{
|
{
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
VideoFrame inputImage;
|
VideoFrame inputImage;
|
||||||
WebRtc_UWord32 frameLength;
|
uint32_t frameLength;
|
||||||
|
|
||||||
// Do not specify maxBitRate (as in ViE).
|
// Do not specify maxBitRate (as in ViE).
|
||||||
_inst.maxBitrate = 0;
|
_inst.maxBitrate = 0;
|
||||||
@ -765,7 +765,7 @@ UnitTest::RateControlTests()
|
|||||||
size_uv,
|
size_uv,
|
||||||
width, height,
|
width, height,
|
||||||
width, half_width, half_width);
|
width, half_width, half_width);
|
||||||
_inputVideoBuffer.set_timestamp(static_cast<WebRtc_UWord32>(9e4 /
|
_inputVideoBuffer.set_timestamp(static_cast<uint32_t>(9e4 /
|
||||||
static_cast<float>(_inst.maxFramerate)));
|
static_cast<float>(_inst.maxFramerate)));
|
||||||
ASSERT_EQ(_encoder->Encode(_inputVideoBuffer, NULL, NULL),
|
ASSERT_EQ(_encoder->Encode(_inputVideoBuffer, NULL, NULL),
|
||||||
WEBRTC_VIDEO_CODEC_OK);
|
WEBRTC_VIDEO_CODEC_OK);
|
||||||
@ -776,12 +776,12 @@ UnitTest::RateControlTests()
|
|||||||
|
|
||||||
_encodedVideoBuffer.SetLength(0);
|
_encodedVideoBuffer.SetLength(0);
|
||||||
}
|
}
|
||||||
WebRtc_UWord32 actualBitrate =
|
uint32_t actualBitrate =
|
||||||
(totalBytes / frames * _inst.maxFramerate * 8)/1000;
|
(totalBytes / frames * _inst.maxFramerate * 8)/1000;
|
||||||
printf("Target bitrate: %d kbps, actual bitrate: %d kbps\n", _bitRate,
|
printf("Target bitrate: %d kbps, actual bitrate: %d kbps\n", _bitRate,
|
||||||
actualBitrate);
|
actualBitrate);
|
||||||
// Test for close match over reasonable range.
|
// Test for close match over reasonable range.
|
||||||
EXPECT_TRUE(abs(WebRtc_Word32(actualBitrate - _bitRate)) <
|
EXPECT_TRUE(abs(int32_t(actualBitrate - _bitRate)) <
|
||||||
0.12 * _bitRate);
|
0.12 * _bitRate);
|
||||||
ASSERT_TRUE(feof(_sourceFile) != 0);
|
ASSERT_TRUE(feof(_sourceFile) != 0);
|
||||||
rewind(_sourceFile);
|
rewind(_sourceFile);
|
||||||
|
@ -39,9 +39,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
UnitTest(std::string name, std::string description);
|
UnitTest(std::string name, std::string description);
|
||||||
virtual WebRtc_UWord32 CodecSpecific_SetBitrate(
|
virtual uint32_t CodecSpecific_SetBitrate(
|
||||||
WebRtc_UWord32 bitRate,
|
uint32_t bitRate,
|
||||||
WebRtc_UWord32 /* frameRate */);
|
uint32_t /* frameRate */);
|
||||||
virtual void Teardown();
|
virtual void Teardown();
|
||||||
virtual void RateControlTests();
|
virtual void RateControlTests();
|
||||||
virtual int Decode();
|
virtual int Decode();
|
||||||
@ -51,8 +51,8 @@ protected:
|
|||||||
virtual bool CheckIfBitExact(const void *ptrA, unsigned int aLengthBytes,
|
virtual bool CheckIfBitExact(const void *ptrA, unsigned int aLengthBytes,
|
||||||
const void *ptrB, unsigned int bLengthBytes);
|
const void *ptrB, unsigned int bLengthBytes);
|
||||||
|
|
||||||
WebRtc_UWord32 WaitForEncodedFrame() const;
|
uint32_t WaitForEncodedFrame() const;
|
||||||
WebRtc_UWord32 WaitForDecodedFrame() const;
|
uint32_t WaitForDecodedFrame() const;
|
||||||
|
|
||||||
int _tests;
|
int _tests;
|
||||||
int _errors;
|
int _errors;
|
||||||
@ -74,14 +74,13 @@ class UnitTestEncodeCompleteCallback : public webrtc::EncodedImageCallback
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UnitTestEncodeCompleteCallback(webrtc::VideoFrame* buffer,
|
UnitTestEncodeCompleteCallback(webrtc::VideoFrame* buffer,
|
||||||
WebRtc_UWord32 decoderSpecificSize = 0,
|
uint32_t decoderSpecificSize = 0,
|
||||||
void* decoderSpecificInfo = NULL) :
|
void* decoderSpecificInfo = NULL) :
|
||||||
_encodedVideoBuffer(buffer),
|
_encodedVideoBuffer(buffer),
|
||||||
_encodeComplete(false) {}
|
_encodeComplete(false) {}
|
||||||
WebRtc_Word32 Encoded(webrtc::EncodedImage& encodedImage,
|
int32_t Encoded(webrtc::EncodedImage& encodedImage,
|
||||||
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
const webrtc::CodecSpecificInfo* codecSpecificInfo,
|
||||||
const webrtc::RTPFragmentationHeader*
|
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
|
||||||
fragmentation = NULL);
|
|
||||||
bool EncodeComplete();
|
bool EncodeComplete();
|
||||||
// Note that this only makes sense if an encode has been completed
|
// Note that this only makes sense if an encode has been completed
|
||||||
webrtc::VideoFrameType EncodedFrameType() const;
|
webrtc::VideoFrameType EncodedFrameType() const;
|
||||||
@ -96,7 +95,7 @@ class UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback
|
|||||||
public:
|
public:
|
||||||
UnitTestDecodeCompleteCallback(webrtc::I420VideoFrame* buffer) :
|
UnitTestDecodeCompleteCallback(webrtc::I420VideoFrame* buffer) :
|
||||||
_decodedVideoBuffer(buffer), _decodeComplete(false) {}
|
_decodedVideoBuffer(buffer), _decodeComplete(false) {}
|
||||||
WebRtc_Word32 Decoded(webrtc::I420VideoFrame& image);
|
int32_t Decoded(webrtc::I420VideoFrame& image);
|
||||||
bool DecodeComplete();
|
bool DecodeComplete();
|
||||||
private:
|
private:
|
||||||
webrtc::I420VideoFrame* _decodedVideoBuffer;
|
webrtc::I420VideoFrame* _decodedVideoBuffer;
|
||||||
|
@ -62,7 +62,7 @@ VideoSource::GetSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
VideoSize
|
VideoSize
|
||||||
VideoSource::GetSize(WebRtc_UWord16 width, WebRtc_UWord16 height)
|
VideoSource::GetSize(uint16_t width, uint16_t height)
|
||||||
{
|
{
|
||||||
if(width == 128 && height == 96)
|
if(width == 128 && height == 96)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
std::string GetName() const;
|
std::string GetName() const;
|
||||||
|
|
||||||
VideoSize GetSize() const;
|
VideoSize GetSize() const;
|
||||||
static VideoSize GetSize(WebRtc_UWord16 width, WebRtc_UWord16 height);
|
static VideoSize GetSize(uint16_t width, uint16_t height);
|
||||||
unsigned int GetFrameLength() const;
|
unsigned int GetFrameLength() const;
|
||||||
|
|
||||||
// Returns a human-readable size string.
|
// Returns a human-readable size string.
|
||||||
|
@ -75,7 +75,7 @@ FrameDropper::Enable(bool enable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FrameDropper::Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame)
|
FrameDropper::Fill(uint32_t frameSizeBytes, bool deltaFrame)
|
||||||
{
|
{
|
||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
{
|
{
|
||||||
@ -104,12 +104,12 @@ FrameDropper::Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame)
|
|||||||
// how much we allow the key frame compensation to be spread
|
// how much we allow the key frame compensation to be spread
|
||||||
// out in time. Therefor we must use the key frame ratio rather
|
// out in time. Therefor we must use the key frame ratio rather
|
||||||
// than keyFrameSpreadFrames.
|
// than keyFrameSpreadFrames.
|
||||||
_keyFrameCount = static_cast<WebRtc_Word32>(1 / _keyFrameRatio.Value() + 0.5);
|
_keyFrameCount = static_cast<int32_t>(1 / _keyFrameRatio.Value() + 0.5);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Compensate for the key frame the following frames
|
// Compensate for the key frame the following frames
|
||||||
_keyFrameCount = static_cast<WebRtc_Word32>(_keyFrameSpreadFrames + 0.5);
|
_keyFrameCount = static_cast<int32_t>(_keyFrameSpreadFrames + 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -123,7 +123,7 @@ FrameDropper::Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FrameDropper::Leak(WebRtc_UWord32 inputFrameRate)
|
FrameDropper::Leak(uint32_t inputFrameRate)
|
||||||
{
|
{
|
||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ FrameDropper::Leak(WebRtc_UWord32 inputFrameRate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FrameDropper::UpdateNack(WebRtc_UWord32 nackBytes)
|
FrameDropper::UpdateNack(uint32_t nackBytes)
|
||||||
{
|
{
|
||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
{
|
{
|
||||||
@ -241,7 +241,7 @@ FrameDropper::DropFrame()
|
|||||||
{
|
{
|
||||||
denom = (float)1e-5;
|
denom = (float)1e-5;
|
||||||
}
|
}
|
||||||
WebRtc_Word32 limit = static_cast<WebRtc_Word32>(1.0f / denom - 1.0f + 0.5f);
|
int32_t limit = static_cast<int32_t>(1.0f / denom - 1.0f + 0.5f);
|
||||||
// Put a bound on the max amount of dropped frames between each kept
|
// Put a bound on the max amount of dropped frames between each kept
|
||||||
// frame, in terms of frame rate and window size (secs).
|
// frame, in terms of frame rate and window size (secs).
|
||||||
int max_limit = static_cast<int>(_incoming_frame_rate *
|
int max_limit = static_cast<int>(_incoming_frame_rate *
|
||||||
@ -284,7 +284,7 @@ FrameDropper::DropFrame()
|
|||||||
{
|
{
|
||||||
denom = (float)1e-5;
|
denom = (float)1e-5;
|
||||||
}
|
}
|
||||||
WebRtc_Word32 limit = -static_cast<WebRtc_Word32>(1.0f / denom - 1.0f + 0.5f);
|
int32_t limit = -static_cast<int32_t>(1.0f / denom - 1.0f + 0.5f);
|
||||||
if (_dropCount > 0)
|
if (_dropCount > 0)
|
||||||
{
|
{
|
||||||
// Reset the _dropCount since we have a positive
|
// Reset the _dropCount since we have a positive
|
||||||
@ -344,7 +344,7 @@ FrameDropper::SetRates(float bitRate, float incoming_frame_rate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
FrameDropper::ActualFrameRate(WebRtc_UWord32 inputFrameRate) const
|
FrameDropper::ActualFrameRate(uint32_t inputFrameRate) const
|
||||||
{
|
{
|
||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
{
|
{
|
||||||
|
@ -49,11 +49,11 @@ public:
|
|||||||
// returned from the encoder.
|
// returned from the encoder.
|
||||||
// - deltaFrame : True if the encoder returned
|
// - deltaFrame : True if the encoder returned
|
||||||
// a key frame.
|
// a key frame.
|
||||||
virtual void Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame);
|
virtual void Fill(uint32_t frameSizeBytes, bool deltaFrame);
|
||||||
|
|
||||||
virtual void Leak(WebRtc_UWord32 inputFrameRate);
|
virtual void Leak(uint32_t inputFrameRate);
|
||||||
|
|
||||||
void UpdateNack(WebRtc_UWord32 nackBytes);
|
void UpdateNack(uint32_t nackBytes);
|
||||||
|
|
||||||
// Sets the target bit rate and the frame rate produced by
|
// Sets the target bit rate and the frame rate produced by
|
||||||
// the camera.
|
// the camera.
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
// Return value : The current average frame rate produced
|
// Return value : The current average frame rate produced
|
||||||
// if the DropFrame() function is used as
|
// if the DropFrame() function is used as
|
||||||
// instruction of when to drop frames.
|
// instruction of when to drop frames.
|
||||||
virtual float ActualFrameRate(WebRtc_UWord32 inputFrameRate) const;
|
virtual float ActualFrameRate(uint32_t inputFrameRate) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FillBucket(float inKbits, float outKbits);
|
void FillBucket(float inKbits, float outKbits);
|
||||||
@ -75,13 +75,13 @@ private:
|
|||||||
VCMExpFilter _keyFrameSizeAvgKbits;
|
VCMExpFilter _keyFrameSizeAvgKbits;
|
||||||
VCMExpFilter _keyFrameRatio;
|
VCMExpFilter _keyFrameRatio;
|
||||||
float _keyFrameSpreadFrames;
|
float _keyFrameSpreadFrames;
|
||||||
WebRtc_Word32 _keyFrameCount;
|
int32_t _keyFrameCount;
|
||||||
float _accumulator;
|
float _accumulator;
|
||||||
float _accumulatorMax;
|
float _accumulatorMax;
|
||||||
float _targetBitRate;
|
float _targetBitRate;
|
||||||
bool _dropNext;
|
bool _dropNext;
|
||||||
VCMExpFilter _dropRatio;
|
VCMExpFilter _dropRatio;
|
||||||
WebRtc_Word32 _dropCount;
|
int32_t _dropCount;
|
||||||
float _windowSize;
|
float _windowSize;
|
||||||
float _incoming_frame_rate;
|
float _incoming_frame_rate;
|
||||||
bool _wasBelowMax;
|
bool _wasBelowMax;
|
||||||
|
@ -27,13 +27,13 @@ class MockFrameDropper : public FrameDropper {
|
|||||||
MOCK_METHOD0(DropFrame,
|
MOCK_METHOD0(DropFrame,
|
||||||
bool());
|
bool());
|
||||||
MOCK_METHOD2(Fill,
|
MOCK_METHOD2(Fill,
|
||||||
void(WebRtc_UWord32 frameSizeBytes, bool deltaFrame));
|
void(uint32_t frameSizeBytes, bool deltaFrame));
|
||||||
MOCK_METHOD1(Leak,
|
MOCK_METHOD1(Leak,
|
||||||
void(WebRtc_UWord32 inputFrameRate));
|
void(uint32_t inputFrameRate));
|
||||||
MOCK_METHOD2(SetRates,
|
MOCK_METHOD2(SetRates,
|
||||||
void(float bitRate, float incoming_frame_rate));
|
void(float bitRate, float incoming_frame_rate));
|
||||||
MOCK_CONST_METHOD1(ActualFrameRate,
|
MOCK_CONST_METHOD1(ActualFrameRate,
|
||||||
float(WebRtc_UWord32 inputFrameRate));
|
float(uint32_t inputFrameRate));
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
Loading…
Reference in New Issue
Block a user