Fixes issue 210. Removes diff between two different arrays.

Also fixes the FrameBuffer copy constructor.

BUG=210
TEST=

Review URL: http://webrtc-codereview.appspot.com/347002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1364 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2012-01-10 11:45:05 +00:00
parent e21a8cf4d4
commit b07aa403b3
3 changed files with 11 additions and 7 deletions

View File

@ -42,6 +42,7 @@ _nackCount(rhs._nackCount),
_latestPacketTimeMs(rhs._latestPacketTimeMs)
{
_sessionInfo = rhs._sessionInfo;
_sessionInfo.UpdateDataPointers(rhs._buffer, _buffer);
}
webrtc::FrameType
@ -165,7 +166,7 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet, WebRtc_Word64 timeInMs,
{
return kSizeError;
}
_sessionInfo.UpdateDataPointers(_buffer - prevBuffer);
_sessionInfo.UpdateDataPointers(prevBuffer, _buffer);
}
CopyCodecSpecific(&packet.codecSpecificHeader);
@ -361,7 +362,7 @@ VCMFrameBuffer::ExtractFromStorage(const EncodedVideoData& frameFromStorage)
{
return VCM_MEMORY;
}
_sessionInfo.UpdateDataPointers(_buffer - prevBuffer);
_sessionInfo.UpdateDataPointers(prevBuffer, _buffer);
memcpy(_buffer, frameFromStorage.payloadData, frameFromStorage.payloadSize);
_length = frameFromStorage.payloadSize;
return VCM_OK;

View File

@ -26,10 +26,13 @@ VCMSessionInfo::VCMSessionInfo()
packets_not_decodable_(0) {
}
void VCMSessionInfo::UpdateDataPointers(ptrdiff_t address_delta) {
void VCMSessionInfo::UpdateDataPointers(const uint8_t* old_base_ptr,
const uint8_t* new_base_ptr) {
for (PacketIterator it = packets_.begin(); it != packets_.end(); ++it)
if ((*it).dataPtr != NULL)
(*it).dataPtr = (*it).dataPtr + address_delta;
if ((*it).dataPtr != NULL) {
assert(old_base_ptr != NULL && new_base_ptr != NULL);
(*it).dataPtr = new_base_ptr + ((*it).dataPtr - old_base_ptr);
}
}
int VCMSessionInfo::LowSequenceNumber() const {

View File

@ -11,7 +11,6 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_SESSION_INFO_H_
#define WEBRTC_MODULES_VIDEO_CODING_SESSION_INFO_H_
#include <cstddef>
#include <list>
#include "modules/interface/module_common_types.h"
@ -24,7 +23,8 @@ class VCMSessionInfo {
public:
VCMSessionInfo();
void UpdateDataPointers(ptrdiff_t address_delta);
void UpdateDataPointers(const uint8_t* old_base_ptr,
const uint8_t* new_base_ptr);
// NACK - Building the NACK lists.
// Build hard NACK list: Zero out all entries in list up to and including
// _lowSeqNum.