[Live-devel] 答复: regardint every rtp packet's timestamp is same
梦幻工作室
fantasyvideo at 126.com
Thu Sep 13 22:46:11 PDT 2012
Thank you for your answer.
Now I change the code as below:
AudioFramedSource::AudioFrameSource()
{
gettimeofday(&m_timescale);
}
void AudioFrameSource::doGetNextFrame()
{
CamerManager::GetInstance()->GetAudioFrame(“test”,(char*)fTo,fMaxSize,&fFr
ameSize,&fNumTruncatedBytes);
Int64_t usec = m_timescale.tv_usec;
usec += 40/8; //since every frame has 40 samples.
If(usec>=1000)
{
m_timescale.tv_sec+= usec/1000;
m_timescale.tv_usec += usec%1000;
}
else
{
m_timescale.tv_usec = usec;
}
fPresentationTime = m_timescale;
}
With the above code, then the timestamp seems created correct. But the vlc
still can’t play it correctly, as I know , vlc accesses rtsp by using
live555. The mplayer can work.
发件人: live-devel-bounces at ns.live555.com
[mailto:live-devel-bounces at ns.live555.com] 代表 Ross Finlayson
发送时间: 2012年9月13日 23:55
收件人: LIVE555 Streaming Media - development & use
主题: Re: [Live-devel] regardint every rtp packet's timestamp is same
And the AudioFrameSource main code is like this:
void AudioFrameSource::doGetNextFrame()
{
CamerManager::GetInstance()->GetAudioFrame(“test”,(char*)fTo,fMaxSize,&fFr
ameSize,&fNumTruncatedBytes);
fPresentationTime.tv_sec=usec/1000;
fPresentationTime.tv_usec = usec%1000;
usec+=200;
Why do you have a variable named "usec", when its value appears to be in
milliseconds, not microseconds?
But anyway, assuming that "usec" is really intended to be a value in
milliseconds: You need to be aware of the following:
1/ The very first value of "usec" - i.e., the value that's used when
"doGetNextFrame()" is called for the first time - must be aligned with 'wall
clock' time - i.e., the time that you'd get by calling "gettimeofday()".
This is important for RTCP-based timing to work properly.
2/ Because you have specified a sampling frequency of 8000 samples per
second, the length of time that you increment "usec" by each time that
"GetAudioFrame()" is called needs to correspond to the number of samples
that "GetAudioFrame()" has returned. The value you are currently
incrementing "usec" by - 200 ms - is almost certainly wrong, because 200 ms
corresponds to 8000*0.2 == 1600 audio samples, which will be too big for an
outgoing RTP packet (assuming default packet size settings). (Note that
each 1-channel u-law audio sample will take up 1 byte.)
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120914/83eebcb2/attachment.html>
More information about the live-devel
mailing list