Add API to retreive last received RTP timestamp to VoiceEngine.
BUG= Review URL: https://webrtc-codereview.appspot.com/969016 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3271 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
d8aeb30d55
commit
0870f02cdb
@ -799,6 +799,8 @@ Channel::OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
|
|||||||
rtpHeader->header.payloadType,
|
rtpHeader->header.payloadType,
|
||||||
rtpHeader->type.Audio.channel);
|
rtpHeader->type.Audio.channel);
|
||||||
|
|
||||||
|
_lastRemoteTimeStamp = rtpHeader->header.timestamp;
|
||||||
|
|
||||||
if (!_playing)
|
if (!_playing)
|
||||||
{
|
{
|
||||||
// Avoid inserting into NetEQ when we are not playing. Count the
|
// Avoid inserting into NetEQ when we are not playing. Count the
|
||||||
@ -1152,6 +1154,7 @@ Channel::Channel(const WebRtc_Word32 channelId,
|
|||||||
_insertExtraRTPPacket(false),
|
_insertExtraRTPPacket(false),
|
||||||
_extraMarkerBit(false),
|
_extraMarkerBit(false),
|
||||||
_lastLocalTimeStamp(0),
|
_lastLocalTimeStamp(0),
|
||||||
|
_lastRemoteTimeStamp(0),
|
||||||
_lastPayloadType(0),
|
_lastPayloadType(0),
|
||||||
_includeAudioLevelIndication(false),
|
_includeAudioLevelIndication(false),
|
||||||
_rtpPacketTimedOut(false),
|
_rtpPacketTimedOut(false),
|
||||||
|
@ -359,6 +359,7 @@ public:
|
|||||||
int InsertExtraRTPPacket(unsigned char payloadType, bool markerBit,
|
int InsertExtraRTPPacket(unsigned char payloadType, bool markerBit,
|
||||||
const char* payloadData,
|
const char* payloadData,
|
||||||
unsigned short payloadSize);
|
unsigned short payloadSize);
|
||||||
|
uint32_t LastRemoteTimeStamp() { return _lastRemoteTimeStamp; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// From AudioPacketizationCallback in the ACM
|
// From AudioPacketizationCallback in the ACM
|
||||||
@ -635,6 +636,7 @@ private:
|
|||||||
bool _insertExtraRTPPacket;
|
bool _insertExtraRTPPacket;
|
||||||
bool _extraMarkerBit;
|
bool _extraMarkerBit;
|
||||||
WebRtc_UWord32 _lastLocalTimeStamp;
|
WebRtc_UWord32 _lastLocalTimeStamp;
|
||||||
|
uint32_t _lastRemoteTimeStamp;
|
||||||
WebRtc_Word8 _lastPayloadType;
|
WebRtc_Word8 _lastPayloadType;
|
||||||
bool _includeAudioLevelIndication;
|
bool _includeAudioLevelIndication;
|
||||||
// VoENetwork
|
// VoENetwork
|
||||||
|
@ -245,6 +245,10 @@ public:
|
|||||||
int channel, unsigned char payloadType, bool markerBit,
|
int channel, unsigned char payloadType, bool markerBit,
|
||||||
const char* payloadData, unsigned short payloadSize) = 0;
|
const char* payloadData, unsigned short payloadSize) = 0;
|
||||||
|
|
||||||
|
// Gets the timestamp of the last RTP packet received by |channel|.
|
||||||
|
virtual int GetLastRemoteTimeStamp(int channel,
|
||||||
|
uint32_t* lastRemoteTimeStamp) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VoERTP_RTCP() {}
|
VoERTP_RTCP() {}
|
||||||
virtual ~VoERTP_RTCP() {}
|
virtual ~VoERTP_RTCP() {}
|
||||||
|
@ -48,3 +48,9 @@ TEST_F(RtpRtcpBeforeStreamingTest, GetLocalSsrcObeysSetLocalSsrc) {
|
|||||||
EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, result));
|
EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, result));
|
||||||
EXPECT_EQ(1234u, result);
|
EXPECT_EQ(1234u, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpRtcpBeforeStreamingTest, GetLastRemoteTimeStamp) {
|
||||||
|
uint32_t timestamp;
|
||||||
|
EXPECT_EQ(0, voe_rtp_rtcp_->GetLastRemoteTimeStamp(channel_, ×tamp));
|
||||||
|
EXPECT_EQ(0u, timestamp);
|
||||||
|
}
|
||||||
|
@ -662,6 +662,27 @@ int VoERTP_RTCPImpl::InsertExtraRTPPacket(int channel,
|
|||||||
payloadSize);
|
payloadSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoERTP_RTCPImpl::GetLastRemoteTimeStamp(int channel,
|
||||||
|
uint32_t* timestamp) {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
"GetLastRemoteTimeStamp(channel=%d, timestamp=?)", channel);
|
||||||
|
if (!_shared->statistics().Initialized())
|
||||||
|
{
|
||||||
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||||
|
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||||
|
if (channelPtr == NULL)
|
||||||
|
{
|
||||||
|
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||||
|
"GetLastRemoteTimeStamp() failed to locate channel");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*timestamp = channelPtr->LastRemoteTimeStamp();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
|
#endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -111,7 +111,8 @@ public:
|
|||||||
bool markerBit,
|
bool markerBit,
|
||||||
const char* payloadData,
|
const char* payloadData,
|
||||||
unsigned short payloadSize);
|
unsigned short payloadSize);
|
||||||
|
virtual int GetLastRemoteTimeStamp(int channel,
|
||||||
|
uint32_t* lastRemoteTimeStamp);
|
||||||
protected:
|
protected:
|
||||||
VoERTP_RTCPImpl(voe::SharedData* shared);
|
VoERTP_RTCPImpl(voe::SharedData* shared);
|
||||||
virtual ~VoERTP_RTCPImpl();
|
virtual ~VoERTP_RTCPImpl();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user