diff options
author | Andreas Huber <andih@google.com> | 2011-02-08 10:18:41 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-02-10 11:53:54 -0800 |
commit | 100a4408968b90e314526185d572c72ea4cc784a (patch) | |
tree | 3b911150d367d8083a4b1d157a217b85da859ab6 /media/libstagefright/rtsp/ARTPSource.cpp | |
parent | fcac8fa9421f442f024018628a6042d7a14fbfb0 (diff) | |
download | frameworks_av-100a4408968b90e314526185d572c72ea4cc784a.zip frameworks_av-100a4408968b90e314526185d572c72ea4cc784a.tar.gz frameworks_av-100a4408968b90e314526185d572c72ea4cc784a.tar.bz2 |
Change timestamp handling in RTSP, remove unused, experimental, gtalk support
related-to-bug: 3216447
NTP timestamp handling is now done at a higher layer than before.
Change-Id: I9fb23f1335110ec59e534f9aa0fe6f6a6406dd52
Diffstat (limited to 'media/libstagefright/rtsp/ARTPSource.cpp')
-rw-r--r-- | media/libstagefright/rtsp/ARTPSource.cpp | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/media/libstagefright/rtsp/ARTPSource.cpp b/media/libstagefright/rtsp/ARTPSource.cpp index 5aae4e7..893a387 100644 --- a/media/libstagefright/rtsp/ARTPSource.cpp +++ b/media/libstagefright/rtsp/ARTPSource.cpp @@ -42,12 +42,12 @@ ARTPSource::ARTPSource( : mID(id), mHighestSeqNumber(0), mNumBuffersReceived(0), - mNumTimes(0), mLastNTPTime(0), mLastNTPTimeUpdateUs(0), mIssueFIRRequests(false), mLastFIRRequestUs(-1), - mNextFIRSeqNo((rand() * 256.0) / RAND_MAX) { + mNextFIRSeqNo((rand() * 256.0) / RAND_MAX), + mNotify(notify) { unsigned long PT; AString desc; AString params; @@ -80,52 +80,25 @@ static uint32_t AbsDiff(uint32_t seq1, uint32_t seq2) { } void ARTPSource::processRTPPacket(const sp<ABuffer> &buffer) { - if (queuePacket(buffer) - && mNumTimes == 2 - && mAssembler != NULL) { + if (queuePacket(buffer) && mAssembler != NULL) { mAssembler->onPacketReceived(this); } } void ARTPSource::timeUpdate(uint32_t rtpTime, uint64_t ntpTime) { - LOGV("timeUpdate"); - mLastNTPTime = ntpTime; mLastNTPTimeUpdateUs = ALooper::GetNowUs(); - if (mNumTimes == 2) { - mNTPTime[0] = mNTPTime[1]; - mRTPTime[0] = mRTPTime[1]; - mNumTimes = 1; - } - mNTPTime[mNumTimes] = ntpTime; - mRTPTime[mNumTimes++] = rtpTime; - - if (timeEstablished()) { - for (List<sp<ABuffer> >::iterator it = mQueue.begin(); - it != mQueue.end(); ++it) { - sp<AMessage> meta = (*it)->meta(); - - uint32_t rtpTime; - CHECK(meta->findInt32("rtp-time", (int32_t *)&rtpTime)); - - meta->setInt64("ntp-time", RTP2NTP(rtpTime)); - } - } + sp<AMessage> notify = mNotify->dup(); + notify->setInt32("time-update", true); + notify->setInt32("rtp-time", rtpTime); + notify->setInt64("ntp-time", ntpTime); + notify->post(); } bool ARTPSource::queuePacket(const sp<ABuffer> &buffer) { uint32_t seqNum = (uint32_t)buffer->int32Data(); - if (mNumTimes == 2) { - sp<AMessage> meta = buffer->meta(); - - uint32_t rtpTime; - CHECK(meta->findInt32("rtp-time", (int32_t *)&rtpTime)); - - meta->setInt64("ntp-time", RTP2NTP(rtpTime)); - } - if (mNumBuffersReceived++ == 0) { mHighestSeqNumber = seqNum; mQueue.push_back(buffer); @@ -180,14 +153,6 @@ bool ARTPSource::queuePacket(const sp<ABuffer> &buffer) { return true; } -uint64_t ARTPSource::RTP2NTP(uint32_t rtpTime) const { - CHECK_EQ(mNumTimes, 2u); - - return mNTPTime[0] + (double)(mNTPTime[1] - mNTPTime[0]) - * ((double)rtpTime - (double)mRTPTime[0]) - / (double)(mRTPTime[1] - mRTPTime[0]); -} - void ARTPSource::byeReceived() { mAssembler->onByeReceived(); } |