My session has one video and audio stream.

In the audio stream’s doGetNextFrame(), I set the fPresentationTime like
this:

void AudioFrameSource::doGetNextFrame() {

    CamerManager::GetInstance()->GetAudioFrame(“test”,(char*)fTo,fMaxSize,
&fFrameSize,&fNumTruncatedBytes);

if (fIsFirstPresentationTime) {

CameraManager::GetInstance()->GetTimeScale(&m_timescale);

           fIsFirstPresentationTime = False; // from now on

       }

    fPresentationTime = m_timescale;

    fDurationInMicroseconds = 5000; // because 40 samples at 8000
samples-per-second have a duration of 5 ms (== 5000 us)

 

    // Compute the next presentation time (i.e., to be used on the next call
to "doGetNextFrame()"):

    m_timescale.tv_usec += fDurationInMicroseconds;

    if (m_timescale.tv_usec > 1000000) {

       ++m_timescale.tv_sec;

       m_timescale.tv_usec -= 1000000;

    }

}

 

In the videoFramesource I set the same timestamp,

void VideoFrameSource::doGetNextFrame() {

    CamerManager::GetInstance()->GetVideoFrame(“test”,(char*)fTo,fMaxSize,
&fFrameSize,&fNumTruncatedBytes);

    if (fIsFirstPresentationTime) {

      CameraManager::GetInstance()->GetTimeScale(&m_timescale);

                   fIsFirstPresentationTime = False; // from now on

       }

    fPresentationTime = m_timescale;

    fDurationInMicroseconds = 5000; // because 40 samples at 8000
samples-per-second have a duration of 5 ms (== 5000 us)

 

    // Compute the next presentation time (i.e., to be used on the next call
to "doGetNextFrame()"):

    m_timescale.tv_usec += fDurationInMicroseconds;

    if (m_timescale.tv_usec > 1000000) {

       ++m_timescale.tv_sec;

       m_timescale.tv_usec -= 1000000;

    }

}

But unfortunately, I use vlc to access it, it can’t work correctly.    If
video is appear, then audio disappears. Otherwise, audio appears, video
disappears.

 

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to