diff options
author | Andreas Huber <andih@google.com> | 2013-03-18 15:11:40 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2013-03-18 15:12:55 -0700 |
commit | a239dd722e760fe4fd7379b454d7722e1f312928 (patch) | |
tree | 1ca5da791df49f1bb4b53824f8387b6f586b8652 /media/libstagefright/wifi-display/rtp | |
parent | 0b530f1050150bb751ae642d5a9dce34141d9475 (diff) | |
download | frameworks_av-a239dd722e760fe4fd7379b454d7722e1f312928.zip frameworks_av-a239dd722e760fe4fd7379b454d7722e1f312928.tar.gz frameworks_av-a239dd722e760fe4fd7379b454d7722e1f312928.tar.bz2 |
Change ANetworkSession implementation to optionally attach timestamps
to fragments of data to be transferred and to log statistics when data
is finally submitted to the POSIX layer.
Change-Id: Icbfcac203cdc5c9eac1634e84d34bb380b316a01
Diffstat (limited to 'media/libstagefright/wifi-display/rtp')
-rw-r--r-- | media/libstagefright/wifi-display/rtp/RTPSender.cpp | 21 | ||||
-rw-r--r-- | media/libstagefright/wifi-display/rtp/RTPSender.h | 4 |
2 files changed, 19 insertions, 6 deletions
diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.cpp b/media/libstagefright/wifi-display/rtp/RTPSender.cpp index 8cd712d..c8e265c 100644 --- a/media/libstagefright/wifi-display/rtp/RTPSender.cpp +++ b/media/libstagefright/wifi-display/rtp/RTPSender.cpp @@ -194,6 +194,9 @@ status_t RTPSender::queueTSPackets( const sp<ABuffer> &tsPackets, uint8_t packetType) { CHECK_EQ(0, tsPackets->size() % 188); + int64_t timeUs; + CHECK(tsPackets->meta()->findInt64("timeUs", &timeUs)); + const size_t numTSPackets = tsPackets->size() / 188; size_t srcOffset = 0; @@ -232,13 +235,19 @@ status_t RTPSender::queueTSPackets( memcpy(&rtp[12], tsPackets->data() + srcOffset, numTSPackets * 188); udpPacket->setRange(0, 12 + numTSPackets * 188); - status_t err = sendRTPPacket(udpPacket, true /* storeInHistory */); + + srcOffset += numTSPackets * 188; + bool isLastPacket = (srcOffset == tsPackets->size()); + + status_t err = sendRTPPacket( + udpPacket, + true /* storeInHistory */, + isLastPacket /* timeValid */, + timeUs); if (err != OK) { return err; } - - srcOffset += numTSPackets * 188; } return OK; @@ -395,11 +404,13 @@ status_t RTPSender::queueAVCBuffer( } status_t RTPSender::sendRTPPacket( - const sp<ABuffer> &buffer, bool storeInHistory) { + const sp<ABuffer> &buffer, bool storeInHistory, + bool timeValid, int64_t timeUs) { CHECK(mRTPConnected); status_t err = mNetSession->sendRequest( - mRTPSessionID, buffer->data(), buffer->size()); + mRTPSessionID, buffer->data(), buffer->size(), + timeValid, timeUs); if (err != OK) { return err; diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.h b/media/libstagefright/wifi-display/rtp/RTPSender.h index 83c6223..90b1796 100644 --- a/media/libstagefright/wifi-display/rtp/RTPSender.h +++ b/media/libstagefright/wifi-display/rtp/RTPSender.h @@ -94,7 +94,9 @@ private: status_t queueTSPackets(const sp<ABuffer> &tsPackets, uint8_t packetType); status_t queueAVCBuffer(const sp<ABuffer> &accessUnit, uint8_t packetType); - status_t sendRTPPacket(const sp<ABuffer> &packet, bool storeInHistory); + status_t sendRTPPacket( + const sp<ABuffer> &packet, bool storeInHistory, + bool timeValid = false, int64_t timeUs = -1ll); void onNetNotify(bool isRTP, const sp<AMessage> &msg); |