Fixes for code analysis warnings.

BUG=
TEST=

Review URL: https://webrtc-codereview.appspot.com/355004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1467 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2012-01-19 12:30:21 +00:00
parent 6748087467
commit 8e50693736
9 changed files with 28 additions and 17 deletions

View File

@ -40,6 +40,7 @@ VP8Encoder::VP8Encoder():
_width(0),
_height(0),
_maxBitRateKbit(0),
_maxFrameRate(30),
_inited(false),
_timeStamp(0),
_pictureID(0),
@ -537,11 +538,14 @@ VP8Encoder::GetEncodedFrame(const RawImage& input_image)
{
vpx_codec_iter_t iter = NULL;
_encodedImage._frameType = kDeltaFrame;
const vpx_codec_cx_pkt_t *pkt= vpx_codec_get_cx_data(_encoder, &iter); // no lagging => 1 frame at a time
if (pkt == NULL && !_encoder->err)
{
const vpx_codec_cx_pkt_t *pkt= vpx_codec_get_cx_data(_encoder, &iter);
if (pkt == NULL) {
if (!_encoder->err) {
// dropped frame
return WEBRTC_VIDEO_CODEC_OK;
} else {
return WEBRTC_VIDEO_CODEC_ERROR;
}
}
else if (pkt->kind == VPX_CODEC_CX_FRAME_PKT)
{
@ -856,7 +860,7 @@ VP8Decoder::Decode(const EncodedImage& inputImage,
#endif
// Store encoded frame if key frame. (Used in Copy method.)
if (inputImage._frameType == kKeyFrame)
if (inputImage._frameType == kKeyFrame && inputImage._buffer != NULL)
{
// Reduce size due to PictureID that we won't copy.
const WebRtc_UWord32 bytesToCopy = inputImage._length;

View File

@ -193,7 +193,7 @@ VCMCodecDataBase::Codec(WebRtc_UWord8 listId, VideoCodec *settings)
#ifdef VIDEOCODEC_VP8
case VCM_VP8_IDX:
{
strncpy(settings->plName, "VP8", 3);
strncpy(settings->plName, "VP8", 4);
settings->codecType = kVideoCodecVP8;
// 96 to 127 dynamic payload types for video codecs
settings->plType = VCM_VP8_PAYLOAD_TYPE;
@ -212,7 +212,7 @@ VCMCodecDataBase::Codec(WebRtc_UWord8 listId, VideoCodec *settings)
#ifdef VIDEOCODEC_I420
case VCM_I420_IDX:
{
strncpy(settings->plName, "I420", 4);
strncpy(settings->plName, "I420", 5);
settings->codecType = kVideoCodecI420;
// 96 to 127 dynamic payload types for video codecs
settings->plType = VCM_I420_PAYLOAD_TYPE;
@ -704,8 +704,9 @@ VCMCodecDataBase::ReleaseDecoder(VCMGenericDecoder* decoder) const
{
if (decoder != NULL)
{
assert(&decoder->_decoder != NULL);
decoder->Release();
if (!decoder->External() && &decoder->_decoder != NULL)
if (!decoder->External())
{
delete &decoder->_decoder;
}

View File

@ -23,7 +23,8 @@ _critSect(CriticalSectionWrapper::CreateCriticalSection()),
_clock(clock),
_receiveCallback(NULL),
_timing(timing),
_timestampMap(kDecoderFrameMemoryLength)
_timestampMap(kDecoderFrameMemoryLength),
_lastReceivedPictureID(0)
{
}

View File

@ -164,6 +164,7 @@ VCMGenericEncoder::InternalSource() const
***************************/
VCMEncodedFrameCallback::VCMEncodedFrameCallback():
_sendCallback(),
_mediaOpt(NULL),
_encodedBytes(0),
_payloadType(0),
_bitStreamAfterEncoder(NULL)
@ -236,10 +237,12 @@ VCMEncodedFrameCallback::Encoded(
return VCM_UNINITIALIZED;
}
_encodedBytes = encodedBytes;
_mediaOpt->UpdateWithEncodedData(_encodedBytes, frameType);
if (_internalSource)
{
return _mediaOpt->DropFrame(); // Signal to encoder to drop next frame
if (_mediaOpt != NULL) {
_mediaOpt->UpdateWithEncodedData(_encodedBytes, frameType);
if (_internalSource)
{
return _mediaOpt->DropFrame(); // Signal to encoder to drop next frame
}
}
return VCM_OK;
}

View File

@ -79,6 +79,7 @@ VCMJitterBuffer::VCMJitterBuffer(TickTimeBase* clock,
_incomingFrameCount(0),
_timeLastIncomingFrameCount(0),
_incomingBitCount(0),
_incomingBitRate(0),
_dropCount(0),
_numConsecutiveOldFrames(0),
_numConsecutiveOldPackets(0),
@ -134,6 +135,7 @@ VCMJitterBuffer::CopyFrom(const VCMJitterBuffer& rhs)
_incomingFrameCount = rhs._incomingFrameCount;
_timeLastIncomingFrameCount = rhs._timeLastIncomingFrameCount;
_incomingBitCount = rhs._incomingBitCount;
_incomingBitRate = rhs._incomingBitRate;
_dropCount = rhs._dropCount;
_numConsecutiveOldFrames = rhs._numConsecutiveOldFrames;
_numConsecutiveOldPackets = rhs._numConsecutiveOldPackets;
@ -184,6 +186,7 @@ VCMJitterBuffer::Start()
_incomingFrameCount = 0;
_incomingFrameRate = 0;
_incomingBitCount = 0;
_incomingBitRate = 0;
_timeLastIncomingFrameCount = _clock->MillisecondTimestamp();
memset(_receiveStatistics, 0, sizeof(_receiveStatistics));

View File

@ -421,7 +421,9 @@ VCMReceiver::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size)
size = nackListSize;
return kNackNeedMoreMemory;
}
memcpy(nackList, internalNackList, nackListSize * sizeof(WebRtc_UWord16));
if (internalNackList != NULL && nackListSize > 0) {
memcpy(nackList, internalNackList, nackListSize * sizeof(WebRtc_UWord16));
}
size = nackListSize;
return kNackOk;
}

View File

@ -38,7 +38,6 @@ private:
WebRtc_Word32 _vcmId;
WebRtc_Word32 _id;
TickTimeBase* _clock;
bool _trace;
double _w[2];
double _P[2][2];
WebRtc_Word64 _startMs;

View File

@ -104,8 +104,6 @@ private:
WebRtc_UWord32 _requiredDelayMs;
WebRtc_UWord32 _currentDelayMs;
WebRtc_UWord32 _prevFrameTimestamp;
WebRtc_Word64 _startStoragePlaybackMs;
WebRtc_Word64 _firstStoredRenderTimeMs;
};
} // namespace webrtc

View File

@ -1308,8 +1308,8 @@ VideoCodingModuleImpl::ResetDecoder()
{
_receiver.Initialize();
_timing.Reset();
return _decoder->Reset();
_scheduleKeyRequest = false;
_decoder->Reset();
}
if (_dualReceiver.State() != kPassive)
{