summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/wifi-display/rtp/RTPSender.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2013-03-18 15:11:40 -0700
committerAndreas Huber <andih@google.com>2013-03-18 15:12:55 -0700
commita239dd722e760fe4fd7379b454d7722e1f312928 (patch)
tree1ca5da791df49f1bb4b53824f8387b6f586b8652 /media/libstagefright/wifi-display/rtp/RTPSender.cpp
parent0b530f1050150bb751ae642d5a9dce34141d9475 (diff)
downloadframeworks_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/RTPSender.cpp')
-rw-r--r--media/libstagefright/wifi-display/rtp/RTPSender.cpp21
1 files changed, 16 insertions, 5 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;