Changed RTP reveivers to use stl map and list.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1475 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2012-01-19 15:53:59 +00:00
parent 38f4816737
commit af6f15c1bf
5 changed files with 551 additions and 638 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_H_
#include <map>
#include "typedefs.h"
#include "rtp_utility.h"
@ -208,8 +210,7 @@ private:
WebRtc_Word8 _redPayloadType;
//
MapWrapper _payloadTypeMap;
std::map<WebRtc_Word8, ModuleRTPUtility::Payload*> _payloadTypeMap;
RtpHeaderExtensionMap _rtpHeaderExtensionMap;
// SSRCs

View File

@ -24,7 +24,6 @@ RTPReceiverAudio::RTPReceiverAudio(const WebRtc_Word32 id):
_telephoneEventForwardToDecoder(false),
_telephoneEventDetectEndOfTone(false),
_telephoneEventPayloadType(-1),
_telephoneEventReported(),
_cngNBPayloadType(-1),
_cngWBPayloadType(-1),
_cngSWBPayloadType(-1),
@ -41,26 +40,22 @@ RTPReceiverAudio::~RTPReceiverAudio()
delete _criticalSectionFeedback;
}
WebRtc_Word32
RTPReceiverAudio::Init()
{
_lastReceivedFrequency = 8000;
_telephoneEvent = false;
_telephoneEventForwardToDecoder = false;
_telephoneEventDetectEndOfTone = false;
_telephoneEventPayloadType = -1;
WebRtc_Word32 RTPReceiverAudio::Init() {
_lastReceivedFrequency = 8000;
_telephoneEvent = false;
_telephoneEventForwardToDecoder = false;
_telephoneEventDetectEndOfTone = false;
_telephoneEventPayloadType = -1;
while(_telephoneEventReported.Size() > 0)
{
_telephoneEventReported.Erase(_telephoneEventReported.First());
}
_cngNBPayloadType = -1;
_cngWBPayloadType = -1;
_cngSWBPayloadType = -1;
_cngPayloadType = -1;
_G722PayloadType = -1;
_lastReceivedG722 = false;
return 0;
_telephoneEventReported.clear();
_cngNBPayloadType = -1;
_cngWBPayloadType = -1;
_cngSWBPayloadType = -1;
_cngPayloadType = -1;
_G722PayloadType = -1;
_lastReceivedG722 = false;
return 0;
}
void
@ -342,14 +337,17 @@ RTPReceiverAudio::ParseAudioCodecSpecific(WebRtcRTPHeader* rtpHeader,
{
bool end = (payloadData[(4*n)+1] & 0x80)? true:false;
if(_telephoneEventReported.Find(payloadData[4*n]) != NULL)
std::set<WebRtc_UWord8>::iterator event =
_telephoneEventReported.find(payloadData[4*n]);
if(event != _telephoneEventReported.end())
{
// we have already seen this event
if(end)
{
removedEvents[numberOfRemovedEvents]= payloadData[4*n];
numberOfRemovedEvents++;
_telephoneEventReported.Erase(payloadData[4*n]);
_telephoneEventReported.erase(payloadData[4*n]);
}
}else
{
@ -360,7 +358,7 @@ RTPReceiverAudio::ParseAudioCodecSpecific(WebRtcRTPHeader* rtpHeader,
{
newEvents[numberOfNewEvents] = payloadData[4*n];
numberOfNewEvents++;
_telephoneEventReported.Insert(payloadData[4*n],NULL);
_telephoneEventReported.insert(payloadData[4*n]);
}
}
}
@ -411,8 +409,9 @@ RTPReceiverAudio::ParseAudioCodecSpecific(WebRtcRTPHeader* rtpHeader,
// don't forward event to decoder
return 0;
}
MapItem* first = _telephoneEventReported.First();
if(first && first->GetId() > 15)
std::set<WebRtc_UWord8>::iterator first =
_telephoneEventReported.begin();
if(first != _telephoneEventReported.end() && *first > 15)
{
// don't forward non DTMF events
return 0;

View File

@ -11,11 +11,12 @@
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_AUDIO_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_AUDIO_H_
#include <set>
#include "rtp_rtcp_defines.h"
#include "rtp_utility.h"
#include "typedefs.h"
#include "map_wrapper.h"
namespace webrtc {
class CriticalSectionWrapper;
@ -77,8 +78,8 @@ private:
bool _telephoneEvent;
bool _telephoneEventForwardToDecoder;
bool _telephoneEventDetectEndOfTone;
WebRtc_Word8 _telephoneEventPayloadType;
MapWrapper _telephoneEventReported;
WebRtc_Word8 _telephoneEventPayloadType;
std::set<WebRtc_UWord8> _telephoneEventReported;
WebRtc_Word8 _cngNBPayloadType;
WebRtc_Word8 _cngWBPayloadType;

View File

@ -15,8 +15,6 @@
#include "rtp_utility.h"
#include "typedefs.h"
#include "map_wrapper.h"
#include "list_wrapper.h"
#include "overuse_detector.h"
#include "remote_rate_control.h"
@ -25,12 +23,12 @@
namespace webrtc {
class ReceiverFEC;
class ModuleRtpRtcpImpl;
class CriticalSectionWrapper;
class RTPReceiverVideo
{
public:
RTPReceiverVideo(const WebRtc_Word32 id,
ModuleRtpRtcpImpl* owner);
RTPReceiverVideo(const WebRtc_Word32 id, ModuleRtpRtcpImpl* owner);
virtual ~RTPReceiverVideo();