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:
pbos@webrtc.org 2013-04-08 11:13:29 +00:00
parent 2f44673d66
commit 034f004a4f
21 changed files with 183 additions and 197 deletions

View File

@ -21,66 +21,56 @@ namespace webrtc {
class MockEncodedImageCallback : public EncodedImageCallback {
public:
MOCK_METHOD3(Encoded,
WebRtc_Word32(EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo,
const RTPFragmentationHeader* fragmentation));
MOCK_METHOD3(Encoded, int32_t(EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo,
const RTPFragmentationHeader* fragmentation));
};
class MockVideoEncoder : public VideoEncoder {
public:
MOCK_CONST_METHOD2(Version,
WebRtc_Word32(WebRtc_Word8 *version,
WebRtc_Word32 length));
MOCK_METHOD3(InitEncode,
WebRtc_Word32(const VideoCodec* codecSettings,
WebRtc_Word32 numberOfCores,
WebRtc_UWord32 maxPayloadSize));
MOCK_METHOD3(Encode,
WebRtc_Word32(const I420VideoFrame& inputImage,
const CodecSpecificInfo* codecSpecificInfo,
const std::vector<VideoFrameType>* frame_types));
MOCK_CONST_METHOD2(Version, int32_t(int8_t *version, int32_t length));
MOCK_METHOD3(InitEncode, int32_t(const VideoCodec* codecSettings,
int32_t numberOfCores,
uint32_t maxPayloadSize));
MOCK_METHOD3(Encode, int32_t(const I420VideoFrame& inputImage,
const CodecSpecificInfo* codecSpecificInfo,
const std::vector<VideoFrameType>* frame_types));
MOCK_METHOD1(RegisterEncodeCompleteCallback,
WebRtc_Word32(EncodedImageCallback* callback));
MOCK_METHOD0(Release, WebRtc_Word32());
MOCK_METHOD0(Reset, WebRtc_Word32());
MOCK_METHOD2(SetChannelParameters, WebRtc_Word32(WebRtc_UWord32 packetLoss,
int rtt));
MOCK_METHOD2(SetRates,
WebRtc_Word32(WebRtc_UWord32 newBitRate,
WebRtc_UWord32 frameRate));
MOCK_METHOD1(SetPeriodicKeyFrames, WebRtc_Word32(bool enable));
int32_t(EncodedImageCallback* callback));
MOCK_METHOD0(Release, int32_t());
MOCK_METHOD0(Reset, int32_t());
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int rtt));
MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
MOCK_METHOD1(SetPeriodicKeyFrames, int32_t(bool enable));
MOCK_METHOD2(CodecConfigParameters,
WebRtc_Word32(WebRtc_UWord8* /*buffer*/, WebRtc_Word32));
int32_t(uint8_t* /*buffer*/, int32_t));
};
class MockDecodedImageCallback : public DecodedImageCallback {
public:
MOCK_METHOD1(Decoded,
WebRtc_Word32(I420VideoFrame& decodedImage));
int32_t(I420VideoFrame& decodedImage));
MOCK_METHOD1(ReceivedDecodedReferenceFrame,
WebRtc_Word32(const WebRtc_UWord64 pictureId));
int32_t(const uint64_t pictureId));
MOCK_METHOD1(ReceivedDecodedFrame,
WebRtc_Word32(const WebRtc_UWord64 pictureId));
int32_t(const uint64_t pictureId));
};
class MockVideoDecoder : public VideoDecoder {
public:
MOCK_METHOD2(InitDecode,
WebRtc_Word32(const VideoCodec* codecSettings,
WebRtc_Word32 numberOfCores));
MOCK_METHOD5(Decode,
WebRtc_Word32(const EncodedImage& inputImage,
bool missingFrames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codecSpecificInfo,
WebRtc_Word64 renderTimeMs));
MOCK_METHOD2(InitDecode, int32_t(const VideoCodec* codecSettings,
int32_t numberOfCores));
MOCK_METHOD5(Decode, int32_t(const EncodedImage& inputImage,
bool missingFrames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codecSpecificInfo,
int64_t renderTimeMs));
MOCK_METHOD1(RegisterDecodeCompleteCallback,
WebRtc_Word32(DecodedImageCallback* callback));
MOCK_METHOD0(Release, WebRtc_Word32());
MOCK_METHOD0(Reset, WebRtc_Word32());
int32_t(DecodedImageCallback* callback));
MOCK_METHOD0(Release, int32_t());
MOCK_METHOD0(Reset, int32_t());
MOCK_METHOD2(SetCodecConfigParameters,
WebRtc_Word32(const WebRtc_UWord8* /*buffer*/, WebRtc_Word32));
int32_t(const uint8_t* /*buffer*/, int32_t));
MOCK_METHOD0(Copy, VideoDecoder*());
};

View File

@ -31,16 +31,16 @@ class RTPFragmentationHeader; // forward declaration
struct CodecSpecificInfoVP8
{
bool hasReceivedSLI;
WebRtc_UWord8 pictureIdSLI;
uint8_t pictureIdSLI;
bool hasReceivedRPSI;
WebRtc_UWord64 pictureIdRPSI;
WebRtc_Word16 pictureId; // negative value to skip pictureId
uint64_t pictureIdRPSI;
int16_t pictureId; // negative value to skip pictureId
bool nonReference;
WebRtc_UWord8 simulcastIdx;
WebRtc_UWord8 temporalIdx;
uint8_t simulcastIdx;
uint8_t temporalIdx;
bool layerSync;
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
@ -71,7 +71,7 @@ public:
// should be dropped to keep bit rate or frame rate.
// = 0, if OK.
// < 0, on error.
virtual WebRtc_Word32
virtual int32_t
Encoded(EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo = NULL,
const RTPFragmentationHeader* fragmentation = NULL) = 0;
@ -91,7 +91,7 @@ public:
// to have. Usually MTU - overhead.
//
// 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
// 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
// otherwise.
virtual WebRtc_Word32 Encode(
virtual int32_t Encode(
const I420VideoFrame& inputImage,
const CodecSpecificInfo* codecSpecificInfo,
const std::vector<VideoFrameType>* frame_types) = 0;
@ -114,12 +114,12 @@ public:
// - callback : Callback object which handles encoded images.
//
// 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.
//
// 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
// network used to decide the best pattern and signaling.
@ -129,8 +129,7 @@ public:
// - rtt : Round-trip time in milliseconds
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 packetLoss,
int rtt) = 0;
virtual int32_t SetChannelParameters(uint32_t packetLoss, int rtt) = 0;
// Inform the encoder about the new target bit rate.
//
@ -138,7 +137,7 @@ public:
// - frameRate : The target frame rate
//
// 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
// which have other ways of stopping error propagation.
@ -146,7 +145,7 @@ public:
// - enable : Enable or disable periodic key frames
//
// 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
//
@ -155,7 +154,7 @@ public:
// - size : The size of the buffer in bytes
//
// 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
@ -169,11 +168,11 @@ public:
// - decodedImage : The decoded image.
//
// 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
@ -188,7 +187,7 @@ public:
// - numberOfCores : Number of cores available for the decoder
//
// 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
// will be returned to the user through the decode complete callback.
@ -207,12 +206,12 @@ public:
// used by decoders with internal rendering.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32
virtual int32_t
Decode(const EncodedImage& inputImage,
bool missingFrames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codecSpecificInfo = NULL,
WebRtc_Word64 renderTimeMs = -1) = 0;
int64_t renderTimeMs = -1) = 0;
// Register an decode complete callback object.
//
@ -220,17 +219,17 @@ public:
// - callback : Callback object which handles decoded images.
//
// 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.
//
// 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.
//
// 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
//
@ -240,7 +239,7 @@ public:
// bytes
//
// 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.
//

View File

@ -45,7 +45,7 @@ int PacketManipulatorImpl::ManipulatePackets(
packet_reader_->InitializeReading(encoded_image->_buffer,
encoded_image->_length,
config_.packet_size_in_bytes);
WebRtc_UWord8* packet = NULL;
uint8_t* packet = NULL;
int nbr_bytes_to_read;
// keep track of if we've lost any packets, since then we shall loose
// the remains of the current frame:

View File

@ -61,7 +61,7 @@ class PacketManipulatorTest: public PacketRelatedTest {
void VerifyPacketLoss(int expected_nbr_packets_dropped,
int actual_nbr_packets_dropped,
int expected_packet_data_length,
WebRtc_UWord8* expected_packet_data,
uint8_t* expected_packet_data,
EncodedImage& actual_image) {
EXPECT_EQ(expected_nbr_packets_dropped, actual_nbr_packets_dropped);
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)
const int kNbrPackets = 10;
const int kDataLength = kPacketSizeInBytes * kNbrPackets;
WebRtc_UWord8 data[kDataLength];
WebRtc_UWord8* data_pointer = data;
uint8_t data[kDataLength];
uint8_t* data_pointer = data;
// Fill with 0s, 1s and so on to be able to easily verify which were dropped:
for (int i = 0; i < kNbrPackets; ++i) {
memset(data_pointer + i * kPacketSizeInBytes, i, kPacketSizeInBytes);

View File

@ -61,8 +61,8 @@ bool VideoProcessorImpl::Init() {
// Initialize data structures used by the encoder/decoder APIs
size_t frame_length_in_bytes = frame_reader_->FrameLength();
source_buffer_ = new WebRtc_UWord8[frame_length_in_bytes];
last_successful_frame_buffer_ = new WebRtc_UWord8[frame_length_in_bytes];
source_buffer_ = new uint8_t[frame_length_in_bytes];
last_successful_frame_buffer_ = new uint8_t[frame_length_in_bytes];
// Set fixed properties common for all frames.
// To keep track of spatial resize actions by encoder.
last_encoder_frame_width_ = config_.codec_settings->width;
@ -71,7 +71,7 @@ bool VideoProcessorImpl::Init() {
// Setup required callbacks for the encoder/decoder:
encode_callback_ = new VideoProcessorEncodeCompleteCallback(this);
decode_callback_ = new VideoProcessorDecodeCompleteCallback(this);
WebRtc_Word32 register_result =
int32_t register_result =
encoder_->RegisterEncodeCompleteCallback(encode_callback_);
if (register_result != WEBRTC_VIDEO_CODEC_OK) {
fprintf(stderr, "Failed to register encode complete callback, return code: "
@ -85,11 +85,11 @@ bool VideoProcessorImpl::Init() {
return false;
}
// Init the encoder and decoder
WebRtc_UWord32 nbr_of_cores = 1;
uint32_t nbr_of_cores = 1;
if (!config_.use_single_core) {
nbr_of_cores = CpuInfo::DetectNumberOfCores();
}
WebRtc_Word32 init_result =
int32_t init_result =
encoder_->InitEncode(config_.codec_settings, nbr_of_cores,
config_.networking_config.max_payload_size_in_bytes);
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.
encoded_frame_size_ = 0;
WebRtc_Word32 encode_result = encoder_->Encode(source_frame_, NULL,
&frame_types);
int32_t encode_result = encoder_->Encode(source_frame_, NULL, &frame_types);
if (encode_result != WEBRTC_VIDEO_CODEC_OK) {
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();
// TODO(kjellander): Pass fragmentation header to the decoder when
// CL 172001 has been submitted and PacketManipulator supports this.
WebRtc_Word32 decode_result = decoder_->Decode(*encoded_image,
last_frame_missing_, NULL);
int32_t decode_result = decoder_->Decode(*encoded_image, last_frame_missing_,
NULL);
stat.decode_return_code = decode_result;
if (decode_result != WEBRTC_VIDEO_CODEC_OK) {
// 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(
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 <
static_cast<unsigned int>(std::numeric_limits<int>::max()));
return static_cast<int>(encode_time);
@ -379,7 +378,7 @@ const char* VideoCodecTypeToStr(webrtc::VideoCodecType e) {
}
// Callbacks
WebRtc_Word32
int32_t
VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
EncodedImage& encoded_image,
const webrtc::CodecSpecificInfo* codec_specific_info,
@ -387,7 +386,7 @@ VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
video_processor_->FrameEncoded(&encoded_image); // Forward to parent class.
return 0;
}
WebRtc_Word32
int32_t
VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded(
I420VideoFrame& image) {
video_processor_->FrameDecoded(image); // forward to parent class

View File

@ -200,10 +200,10 @@ class VideoProcessorImpl : public VideoProcessor {
EncodedImageCallback* encode_callback_;
DecodedImageCallback* decode_callback_;
// 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
// when decoding fails:
WebRtc_UWord8* last_successful_frame_buffer_;
uint8_t* last_successful_frame_buffer_;
webrtc::I420VideoFrame source_frame_;
// To keep track of if we have excluded the first key frame from packet loss:
bool first_key_frame_has_been_excluded_;
@ -231,10 +231,9 @@ class VideoProcessorImpl : public VideoProcessor {
explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp)
: video_processor_(vp) {
}
WebRtc_Word32 Encoded(
webrtc::EncodedImage& encoded_image,
const webrtc::CodecSpecificInfo* codec_specific_info = NULL,
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
int32_t Encoded(webrtc::EncodedImage& encoded_image,
const webrtc::CodecSpecificInfo* codec_specific_info = NULL,
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
private:
VideoProcessorImpl* video_processor_;
@ -247,7 +246,7 @@ class VideoProcessorImpl : public VideoProcessor {
explicit VideoProcessorDecodeCompleteCallback(VideoProcessorImpl* vp)
: video_processor_(vp) {
}
WebRtc_Word32 Decoded(webrtc::I420VideoFrame& image);
int32_t Decoded(webrtc::I420VideoFrame& image);
private:
VideoProcessorImpl* video_processor_;

View File

@ -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",
bitRate, _testNo),
@ -86,7 +86,7 @@ _waitForKey(false)
}
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),
_decodeCompleteTime(0),
@ -107,7 +107,7 @@ _waitForKey(false)
}
NormalAsyncTest::NormalAsyncTest(std::string name, std::string description,
WebRtc_UWord32 bitRate, unsigned int testNo,
uint32_t bitRate, unsigned int testNo,
unsigned int rttFrames)
:
NormalTest(name, description, bitRate, _testNo),
@ -223,12 +223,12 @@ bool FrameQueue::Empty()
return _frameBufferQueue.empty();
}
WebRtc_UWord32 VideoEncodeCompleteCallback::EncodedBytes()
uint32_t VideoEncodeCompleteCallback::EncodedBytes()
{
return _encodedBytes;
}
WebRtc_Word32
int32_t
VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader*
@ -256,12 +256,12 @@ VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
return 0;
}
WebRtc_UWord32 VideoDecodeCompleteCallback::DecodedBytes()
uint32_t VideoDecodeCompleteCallback::DecodedBytes()
{
return _decodedBytes;
}
WebRtc_Word32
int32_t
VideoDecodeCompleteCallback::Decoded(I420VideoFrame& image)
{
_test.Decoded(image);
@ -273,16 +273,16 @@ VideoDecodeCompleteCallback::Decoded(I420VideoFrame& image)
return 0;
}
WebRtc_Word32
int32_t
VideoDecodeCompleteCallback::ReceivedDecodedReferenceFrame(
const WebRtc_UWord64 pictureId)
const uint64_t pictureId)
{
return _test.ReceivedDecodedReferenceFrame(pictureId);
}
WebRtc_Word32
int32_t
VideoDecodeCompleteCallback::ReceivedDecodedFrame(
const WebRtc_UWord64 pictureId)
const uint64_t pictureId)
{
return _test.ReceivedDecodedFrame(pictureId);
}
@ -511,7 +511,7 @@ NormalAsyncTest::Decode(int lossValue)
// add an SLI feedback to the feedback "queue"
// to be delivered to encoder with _rttFrames delay
_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;
}
@ -520,7 +520,7 @@ NormalAsyncTest::Decode(int lossValue)
// add an SLI feedback to the feedback "queue"
// to be delivered to encoder with _rttFrames delay
_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;
}
@ -574,19 +574,19 @@ void NormalAsyncTest::CopyEncodedImage(VideoFrame& dest,
{
dest.CopyFrame(src._length, src._buffer);
//dest.SetFrameType(src._frameType);
dest.SetWidth((WebRtc_UWord16)src._encodedWidth);
dest.SetHeight((WebRtc_UWord16)src._encodedHeight);
dest.SetWidth((uint16_t)src._encodedWidth);
dest.SetHeight((uint16_t)src._encodedHeight);
dest.SetTimeStamp(src._timeStamp);
}
WebRtc_Word32 NormalAsyncTest::ReceivedDecodedReferenceFrame(
const WebRtc_UWord64 pictureId) {
int32_t NormalAsyncTest::ReceivedDecodedReferenceFrame(
const uint64_t pictureId) {
_lastDecRefPictureId = pictureId;
return 0;
}
WebRtc_Word32 NormalAsyncTest::ReceivedDecodedFrame(
const WebRtc_UWord64 pictureId) {
int32_t NormalAsyncTest::ReceivedDecodedFrame(
const uint64_t pictureId) {
_lastDecPictureId = pictureId;
return 0;
}

View File

@ -60,22 +60,22 @@ private:
// feedback signal to encoder
struct fbSignal
{
fbSignal(int d, WebRtc_UWord8 pid) : delay(d), id(pid) {};
fbSignal(int d, uint8_t pid) : delay(d), id(pid) {};
int delay;
WebRtc_UWord8 id;
uint8_t id;
};
class NormalAsyncTest : public NormalTest
{
public:
NormalAsyncTest();
NormalAsyncTest(WebRtc_UWord32 bitRate);
NormalAsyncTest(uint32_t bitRate);
NormalAsyncTest(std::string name, std::string description,
unsigned int testNo);
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,
WebRtc_UWord32 bitRate, unsigned int testNo,
uint32_t bitRate, unsigned int testNo,
unsigned int rttFrames);
virtual ~NormalAsyncTest() {};
virtual void Perform();
@ -91,9 +91,9 @@ public:
{
return NULL;
};
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(
const WebRtc_UWord64 pictureId);
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId);
virtual int32_t ReceivedDecodedReferenceFrame(
const uint64_t pictureId);
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
protected:
virtual void Setup();
@ -106,8 +106,8 @@ protected:
FILE* _sourceFile;
FILE* _decodedFile;
WebRtc_UWord32 _decodedWidth;
WebRtc_UWord32 _decodedHeight;
uint32_t _decodedWidth;
uint32_t _decodedHeight;
double _totalEncodeTime;
double _totalDecodeTime;
double _decodeCompleteTime;
@ -122,17 +122,17 @@ protected:
unsigned int _lengthEncFrame;
FrameQueueTuple* _frameToDecode;
bool _appendNext;
std::map<WebRtc_UWord32, double> _encodeTimes;
std::map<WebRtc_UWord32, double> _decodeTimes;
std::map<uint32_t, double> _encodeTimes;
std::map<uint32_t, double> _decodeTimes;
bool _missingFrames;
std::list<fbSignal> _signalSLI;
int _rttFrames;
mutable bool _hasReceivedSLI;
mutable bool _hasReceivedRPSI;
WebRtc_UWord8 _pictureIdSLI;
WebRtc_UWord16 _pictureIdRPSI;
WebRtc_UWord64 _lastDecRefPictureId;
WebRtc_UWord64 _lastDecPictureId;
uint8_t _pictureIdSLI;
uint16_t _pictureIdRPSI;
uint64_t _lastDecRefPictureId;
uint64_t _lastDecPictureId;
std::list<fbSignal> _signalPLI;
bool _hasReceivedPLI;
bool _waitForKey;
@ -150,16 +150,16 @@ public:
_encodedBytes(0)
{}
WebRtc_Word32
int32_t
Encoded(webrtc::EncodedImage& encodedImage,
const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
WebRtc_UWord32 EncodedBytes();
uint32_t EncodedBytes();
private:
FILE* _encodedFile;
FrameQueue* _frameQueue;
NormalAsyncTest& _test;
WebRtc_UWord32 _encodedBytes;
uint32_t _encodedBytes;
};
class VideoDecodeCompleteCallback : public webrtc::DecodedImageCallback
@ -172,16 +172,16 @@ public:
_decodedBytes(0)
{}
virtual WebRtc_Word32 Decoded(webrtc::I420VideoFrame& decodedImage);
virtual WebRtc_Word32
ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId);
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId);
virtual int32_t Decoded(webrtc::I420VideoFrame& decodedImage);
virtual int32_t
ReceivedDecodedReferenceFrame(const uint64_t pictureId);
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
WebRtc_UWord32 DecodedBytes();
uint32_t DecodedBytes();
private:
FILE* _decodedFile;
NormalAsyncTest& _test;
WebRtc_UWord32 _decodedBytes;
uint32_t _decodedBytes;
};
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_FRAMEWORK_NORMAL_ASYNC_TEST_H_

View File

@ -39,7 +39,7 @@ _appendNext(false)
}
NormalTest::NormalTest(std::string name, std::string description,
WebRtc_UWord32 bitRate, unsigned int testNo)
uint32_t bitRate, unsigned int testNo)
:
CodecTest(name, description, bitRate),
_requestKeyFrame(false),

View File

@ -18,7 +18,7 @@ class NormalTest : public CodecTest
public:
NormalTest();
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 void Perform();

View File

@ -96,7 +96,7 @@ PacketLossTest::Decoded(const I420VideoFrame& decodedImage)
{
if (_lastFrame) delete [] _lastFrame;
_lastFrame = new WebRtc_UWord8[length];
_lastFrame = new uint8_t[length];
}
// TODO(mikhal): Can't the last frame be a I420VideoFrame?
ExtractBuffer(decodedImage, length, _lastFrame);
@ -154,11 +154,11 @@ void
PacketLossTest::CodecSpecific_InitBitrate()
{
assert(_bitRate > 0);
WebRtc_UWord32 simulatedBitRate;
uint32_t simulatedBitRate;
if (_lossProbability != _lossRate)
{
// Simulating NACK
simulatedBitRate = WebRtc_UWord32(_bitRate / (1 + _lossRate));
simulatedBitRate = uint32_t(_bitRate / (1 + _lossRate));
}
else
{
@ -167,7 +167,7 @@ PacketLossTest::CodecSpecific_InitBitrate()
int rtt = 0;
if (_inst.maxFramerate > 0)
rtt = _rttFrames * (1000 / _inst.maxFramerate);
_encoder->SetChannelParameters((WebRtc_UWord32)(_lossProbability * 255.0),
_encoder->SetChannelParameters((uint32_t)(_lossProbability * 255.0),
rtt);
_encoder->SetRates(simulatedBitRate, _inst.maxFramerate);
}

View File

@ -51,9 +51,9 @@ protected:
int _totalKept;
int _totalThrown;
int _sumChannelBytes;
std::list<WebRtc_UWord32> _frameQueue;
WebRtc_UWord8* _lastFrame;
WebRtc_UWord32 _lastFrameLength;
std::list<uint32_t> _frameQueue;
uint8_t* _lastFrame;
uint32_t _lastFrameLength;
};

View File

@ -35,7 +35,7 @@ _description(description)
}
CodecTest::CodecTest(std::string name, std::string description,
WebRtc_UWord32 bitRate)
uint32_t bitRate)
:
_bitRate(bitRate),
_inname(""),
@ -88,8 +88,8 @@ CodecTest::Setup()
void
CodecTest::CodecSettings(int width, int height,
WebRtc_UWord32 frameRate /*=30*/,
WebRtc_UWord32 bitRate /*=0*/)
uint32_t frameRate /*=30*/,
uint32_t bitRate /*=0*/)
{
if (bitRate > 0)
{

View File

@ -22,7 +22,7 @@ class CodecTest
public:
CodecTest(std::string name, std::string description);
CodecTest(std::string name, std::string description,
WebRtc_UWord32 bitRate);
uint32_t bitRate);
virtual ~CodecTest() {};
virtual void Setup();
virtual void Perform()=0;
@ -34,8 +34,8 @@ public:
protected:
virtual void CodecSettings(int width,
int height,
WebRtc_UWord32 frameRate=30,
WebRtc_UWord32 bitRate=0);
uint32_t frameRate=30,
uint32_t bitRate=0);
virtual void Teardown();
double ActualBitRate(int nFrames);
virtual bool PacketLoss(double lossRate, int /*thrown*/);
@ -46,7 +46,7 @@ protected:
webrtc::VideoEncoder* _encoder;
webrtc::VideoDecoder* _decoder;
WebRtc_UWord32 _bitRate;
uint32_t _bitRate;
unsigned int _lengthSourceFrame;
unsigned char* _sourceBuffer;
webrtc::I420VideoFrame _inputVideoBuffer;

View File

@ -89,7 +89,7 @@ UnitTest::~UnitTest()
}
}
WebRtc_Word32
int32_t
UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader*
@ -101,16 +101,16 @@ UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
// TODO(mikhal): Update frame type API.
// _encodedVideoBuffer->SetFrameType(encodedImage._frameType);
_encodedVideoBuffer->SetWidth(
(WebRtc_UWord16)encodedImage._encodedWidth);
(uint16_t)encodedImage._encodedWidth);
_encodedVideoBuffer->SetHeight(
(WebRtc_UWord16)encodedImage._encodedHeight);
(uint16_t)encodedImage._encodedHeight);
_encodedVideoBuffer->SetTimeStamp(encodedImage._timeStamp);
_encodeComplete = true;
_encodedFrameType = encodedImage._frameType;
return 0;
}
WebRtc_Word32 UnitTestDecodeCompleteCallback::Decoded(I420VideoFrame& image)
int32_t UnitTestDecodeCompleteCallback::Decoded(I420VideoFrame& image)
{
_decodedVideoBuffer->CopyFrame(image);
_decodeComplete = true;
@ -145,10 +145,10 @@ UnitTestDecodeCompleteCallback::DecodeComplete()
return false;
}
WebRtc_UWord32
uint32_t
UnitTest::WaitForEncodedFrame() const
{
WebRtc_Word64 startTime = TickTime::MillisecondTimestamp();
int64_t startTime = TickTime::MillisecondTimestamp();
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs)
{
if (_encodeCompleteCallback->EncodeComplete())
@ -159,10 +159,10 @@ UnitTest::WaitForEncodedFrame() const
return 0;
}
WebRtc_UWord32
uint32_t
UnitTest::WaitForDecodedFrame() const
{
WebRtc_Word64 startTime = TickTime::MillisecondTimestamp();
int64_t startTime = TickTime::MillisecondTimestamp();
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitDecTimeMs)
{
if (_decodeCompleteCallback->DecodeComplete())
@ -174,9 +174,9 @@ UnitTest::WaitForDecodedFrame() const
return 0;
}
WebRtc_UWord32
UnitTest::CodecSpecific_SetBitrate(WebRtc_UWord32 bitRate,
WebRtc_UWord32 /* frameRate */)
uint32_t
UnitTest::CodecSpecific_SetBitrate(uint32_t bitRate,
uint32_t /* frameRate */)
{
return _encoder->SetRates(bitRate, _inst.maxFramerate);
}
@ -365,8 +365,8 @@ UnitTest::Perform()
EXPECT_TRUE(_encoder->InitEncode(NULL, 1, 1440) ==
WEBRTC_VIDEO_CODEC_ERR_PARAMETER);
// bit rate exceeds max bit rate
WebRtc_Word32 tmpBitRate = _inst.startBitrate;
WebRtc_Word32 tmpMaxBitRate = _inst.maxBitrate;
int32_t tmpBitRate = _inst.startBitrate;
int32_t tmpMaxBitRate = _inst.maxBitrate;
_inst.startBitrate = 4000;
_inst.maxBitrate = 3000;
EXPECT_TRUE(_encoder->InitEncode(&_inst, 1, 1440) ==
@ -716,7 +716,7 @@ UnitTest::RateControlTests()
{
int frames = 0;
VideoFrame inputImage;
WebRtc_UWord32 frameLength;
uint32_t frameLength;
// Do not specify maxBitRate (as in ViE).
_inst.maxBitrate = 0;
@ -765,7 +765,7 @@ UnitTest::RateControlTests()
size_uv,
width, height,
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)));
ASSERT_EQ(_encoder->Encode(_inputVideoBuffer, NULL, NULL),
WEBRTC_VIDEO_CODEC_OK);
@ -776,12 +776,12 @@ UnitTest::RateControlTests()
_encodedVideoBuffer.SetLength(0);
}
WebRtc_UWord32 actualBitrate =
uint32_t actualBitrate =
(totalBytes / frames * _inst.maxFramerate * 8)/1000;
printf("Target bitrate: %d kbps, actual bitrate: %d kbps\n", _bitRate,
actualBitrate);
// Test for close match over reasonable range.
EXPECT_TRUE(abs(WebRtc_Word32(actualBitrate - _bitRate)) <
EXPECT_TRUE(abs(int32_t(actualBitrate - _bitRate)) <
0.12 * _bitRate);
ASSERT_TRUE(feof(_sourceFile) != 0);
rewind(_sourceFile);

View File

@ -39,9 +39,9 @@ public:
protected:
UnitTest(std::string name, std::string description);
virtual WebRtc_UWord32 CodecSpecific_SetBitrate(
WebRtc_UWord32 bitRate,
WebRtc_UWord32 /* frameRate */);
virtual uint32_t CodecSpecific_SetBitrate(
uint32_t bitRate,
uint32_t /* frameRate */);
virtual void Teardown();
virtual void RateControlTests();
virtual int Decode();
@ -51,8 +51,8 @@ protected:
virtual bool CheckIfBitExact(const void *ptrA, unsigned int aLengthBytes,
const void *ptrB, unsigned int bLengthBytes);
WebRtc_UWord32 WaitForEncodedFrame() const;
WebRtc_UWord32 WaitForDecodedFrame() const;
uint32_t WaitForEncodedFrame() const;
uint32_t WaitForDecodedFrame() const;
int _tests;
int _errors;
@ -74,14 +74,13 @@ class UnitTestEncodeCompleteCallback : public webrtc::EncodedImageCallback
{
public:
UnitTestEncodeCompleteCallback(webrtc::VideoFrame* buffer,
WebRtc_UWord32 decoderSpecificSize = 0,
uint32_t decoderSpecificSize = 0,
void* decoderSpecificInfo = NULL) :
_encodedVideoBuffer(buffer),
_encodeComplete(false) {}
WebRtc_Word32 Encoded(webrtc::EncodedImage& encodedImage,
const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader*
fragmentation = NULL);
int32_t Encoded(webrtc::EncodedImage& encodedImage,
const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader* fragmentation = NULL);
bool EncodeComplete();
// Note that this only makes sense if an encode has been completed
webrtc::VideoFrameType EncodedFrameType() const;
@ -96,7 +95,7 @@ class UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback
public:
UnitTestDecodeCompleteCallback(webrtc::I420VideoFrame* buffer) :
_decodedVideoBuffer(buffer), _decodeComplete(false) {}
WebRtc_Word32 Decoded(webrtc::I420VideoFrame& image);
int32_t Decoded(webrtc::I420VideoFrame& image);
bool DecodeComplete();
private:
webrtc::I420VideoFrame* _decodedVideoBuffer;

View File

@ -62,7 +62,7 @@ VideoSource::GetSize() const
}
VideoSize
VideoSource::GetSize(WebRtc_UWord16 width, WebRtc_UWord16 height)
VideoSource::GetSize(uint16_t width, uint16_t height)
{
if(width == 128 && height == 96)
{

View File

@ -70,7 +70,7 @@ public:
std::string GetName() 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;
// Returns a human-readable size string.

View File

@ -75,7 +75,7 @@ FrameDropper::Enable(bool enable)
}
void
FrameDropper::Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame)
FrameDropper::Fill(uint32_t frameSizeBytes, bool deltaFrame)
{
if (!_enabled)
{
@ -104,12 +104,12 @@ FrameDropper::Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame)
// how much we allow the key frame compensation to be spread
// out in time. Therefor we must use the key frame ratio rather
// than keyFrameSpreadFrames.
_keyFrameCount = static_cast<WebRtc_Word32>(1 / _keyFrameRatio.Value() + 0.5);
_keyFrameCount = static_cast<int32_t>(1 / _keyFrameRatio.Value() + 0.5);
}
else
{
// 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
@ -123,7 +123,7 @@ FrameDropper::Fill(WebRtc_UWord32 frameSizeBytes, bool deltaFrame)
}
void
FrameDropper::Leak(WebRtc_UWord32 inputFrameRate)
FrameDropper::Leak(uint32_t inputFrameRate)
{
if (!_enabled)
{
@ -164,7 +164,7 @@ FrameDropper::Leak(WebRtc_UWord32 inputFrameRate)
}
void
FrameDropper::UpdateNack(WebRtc_UWord32 nackBytes)
FrameDropper::UpdateNack(uint32_t nackBytes)
{
if (!_enabled)
{
@ -241,7 +241,7 @@ FrameDropper::DropFrame()
{
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
// frame, in terms of frame rate and window size (secs).
int max_limit = static_cast<int>(_incoming_frame_rate *
@ -284,7 +284,7 @@ FrameDropper::DropFrame()
{
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)
{
// Reset the _dropCount since we have a positive
@ -344,7 +344,7 @@ FrameDropper::SetRates(float bitRate, float incoming_frame_rate)
}
float
FrameDropper::ActualFrameRate(WebRtc_UWord32 inputFrameRate) const
FrameDropper::ActualFrameRate(uint32_t inputFrameRate) const
{
if (!_enabled)
{

View File

@ -49,11 +49,11 @@ public:
// returned from the encoder.
// - deltaFrame : True if the encoder returned
// 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
// the camera.
@ -65,7 +65,7 @@ public:
// Return value : The current average frame rate produced
// if the DropFrame() function is used as
// instruction of when to drop frames.
virtual float ActualFrameRate(WebRtc_UWord32 inputFrameRate) const;
virtual float ActualFrameRate(uint32_t inputFrameRate) const;
private:
void FillBucket(float inKbits, float outKbits);
@ -75,13 +75,13 @@ private:
VCMExpFilter _keyFrameSizeAvgKbits;
VCMExpFilter _keyFrameRatio;
float _keyFrameSpreadFrames;
WebRtc_Word32 _keyFrameCount;
int32_t _keyFrameCount;
float _accumulator;
float _accumulatorMax;
float _targetBitRate;
bool _dropNext;
VCMExpFilter _dropRatio;
WebRtc_Word32 _dropCount;
int32_t _dropCount;
float _windowSize;
float _incoming_frame_rate;
bool _wasBelowMax;

View File

@ -27,13 +27,13 @@ class MockFrameDropper : public FrameDropper {
MOCK_METHOD0(DropFrame,
bool());
MOCK_METHOD2(Fill,
void(WebRtc_UWord32 frameSizeBytes, bool deltaFrame));
void(uint32_t frameSizeBytes, bool deltaFrame));
MOCK_METHOD1(Leak,
void(WebRtc_UWord32 inputFrameRate));
void(uint32_t inputFrameRate));
MOCK_METHOD2(SetRates,
void(float bitRate, float incoming_frame_rate));
MOCK_CONST_METHOD1(ActualFrameRate,
float(WebRtc_UWord32 inputFrameRate));
float(uint32_t inputFrameRate));
};
} // namespace webrtc