summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/wifi-display/rtp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2013-03-25 15:46:52 -0700
committerAndreas Huber <andih@google.com>2013-03-25 16:20:26 -0700
commitdca73b8fe8fa4d991e1a78c02f1939aaeb673cc1 (patch)
tree8f09f89d5a81cc38683193b48ec5baf039590506 /media/libstagefright/wifi-display/rtp
parentd3d9263ce5e10220552026253d0e205986e82490 (diff)
downloadframeworks_av-dca73b8fe8fa4d991e1a78c02f1939aaeb673cc1.zip
frameworks_av-dca73b8fe8fa4d991e1a78c02f1939aaeb673cc1.tar.gz
frameworks_av-dca73b8fe8fa4d991e1a78c02f1939aaeb673cc1.tar.bz2
In "special" mode we now establish a UDP RTCP channel in addition to the
TCP RTP channel and provide feedback on the latency of arriving packets from the sink back to the source. This information is then used to throttle video bitrate. Change-Id: Ic589a3cb65e4893a3ff67de947da6063d32a1c6e
Diffstat (limited to 'media/libstagefright/wifi-display/rtp')
-rw-r--r--media/libstagefright/wifi-display/rtp/RTPSender.cpp20
-rw-r--r--media/libstagefright/wifi-display/rtp/RTPSender.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.cpp b/media/libstagefright/wifi-display/rtp/RTPSender.cpp
index c686e01..9eeeabd 100644
--- a/media/libstagefright/wifi-display/rtp/RTPSender.cpp
+++ b/media/libstagefright/wifi-display/rtp/RTPSender.cpp
@@ -91,8 +91,8 @@ status_t RTPSender::initAsync(
CHECK_NE(rtpMode, TRANSPORT_TCP_INTERLEAVED);
CHECK_NE(rtcpMode, TRANSPORT_TCP_INTERLEAVED);
- if (rtcpMode == TRANSPORT_NONE && remoteRTCPPort >= 0
- || rtcpMode != TRANSPORT_NONE && remoteRTCPPort < 0) {
+ if ((rtcpMode == TRANSPORT_NONE && remoteRTCPPort >= 0)
+ || (rtcpMode != TRANSPORT_NONE && remoteRTCPPort < 0)) {
return INVALID_OPERATION;
}
@@ -616,6 +616,7 @@ status_t RTPSender::onRTCPData(const sp<ABuffer> &buffer) {
break;
case 204: // APP
+ parseAPP(data, headerLength);
break;
case 205: // TSFB (transport layer specific feedback)
@@ -721,6 +722,21 @@ status_t RTPSender::parseTSFB(const uint8_t *data, size_t size) {
return OK;
}
+status_t RTPSender::parseAPP(const uint8_t *data, size_t size) {
+ if (!memcmp("late", &data[8], 4)) {
+ int64_t avgLatencyUs = (int64_t)U64_AT(&data[12]);
+ int64_t maxLatencyUs = (int64_t)U64_AT(&data[20]);
+
+ sp<AMessage> notify = mNotify->dup();
+ notify->setInt32("what", kWhatInformSender);
+ notify->setInt64("avgLatencyUs", avgLatencyUs);
+ notify->setInt64("maxLatencyUs", maxLatencyUs);
+ notify->post();
+ }
+
+ return OK;
+}
+
void RTPSender::notifyInitDone(status_t err) {
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kWhatInitDone);
diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.h b/media/libstagefright/wifi-display/rtp/RTPSender.h
index 8409b8d..3a926ea 100644
--- a/media/libstagefright/wifi-display/rtp/RTPSender.h
+++ b/media/libstagefright/wifi-display/rtp/RTPSender.h
@@ -37,6 +37,7 @@ struct RTPSender : public RTPBase, public AHandler {
kWhatInitDone,
kWhatError,
kWhatNetworkStall,
+ kWhatInformSender,
};
RTPSender(
const sp<ANetworkSession> &netSession,
@@ -105,6 +106,7 @@ private:
status_t onRTCPData(const sp<ABuffer> &data);
status_t parseReceiverReport(const uint8_t *data, size_t size);
status_t parseTSFB(const uint8_t *data, size_t size);
+ status_t parseAPP(const uint8_t *data, size_t size);
void notifyInitDone(status_t err);
void notifyError(status_t err);