summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/wifi-display/MediaSender.cpp
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
commit2aea9552aeba92bbaf9e56c666049ea2d14057b5 (patch)
treefc3cdb049837a7bdd7452620b9b596aad2c831d3 /media/libstagefright/wifi-display/MediaSender.cpp
parentf90debb467a0daf5288e7d8684642ef1119c4bad (diff)
downloadframeworks_av-2aea9552aeba92bbaf9e56c666049ea2d14057b5.zip
frameworks_av-2aea9552aeba92bbaf9e56c666049ea2d14057b5.tar.gz
frameworks_av-2aea9552aeba92bbaf9e56c666049ea2d14057b5.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/MediaSender.cpp')
-rw-r--r--media/libstagefright/wifi-display/MediaSender.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/media/libstagefright/wifi-display/MediaSender.cpp b/media/libstagefright/wifi-display/MediaSender.cpp
index 123bc1c..33af66d 100644
--- a/media/libstagefright/wifi-display/MediaSender.cpp
+++ b/media/libstagefright/wifi-display/MediaSender.cpp
@@ -85,10 +85,11 @@ ssize_t MediaSender::addTrack(const sp<AMessage> &format, uint32_t flags) {
status_t MediaSender::initAsync(
ssize_t trackIndex,
- RTPSender::TransportMode transportMode,
const char *remoteHost,
int32_t remoteRTPPort,
+ RTPSender::TransportMode rtpMode,
int32_t remoteRTCPPort,
+ RTPSender::TransportMode rtcpMode,
int32_t *localRTPPort) {
if (trackIndex < 0) {
if (mMode != MODE_UNDEFINED) {
@@ -126,12 +127,9 @@ status_t MediaSender::initAsync(
err = mTSSender->initAsync(
remoteHost,
remoteRTPPort,
- transportMode, // rtpMode
+ rtpMode,
remoteRTCPPort,
- (transportMode == RTPSender::TRANSPORT_UDP
- && remoteRTCPPort >= 0)
- ? transportMode
- : RTPSender::TRANSPORT_NONE, // rtcpMode
+ rtcpMode,
localRTPPort);
if (err != OK) {
@@ -180,11 +178,9 @@ status_t MediaSender::initAsync(
status_t err = info->mSender->initAsync(
remoteHost,
remoteRTPPort,
- transportMode, // rtpMode
+ rtpMode,
remoteRTCPPort,
- (transportMode == RTPSender::TRANSPORT_UDP && remoteRTCPPort >= 0)
- ? transportMode
- : RTPSender::TRANSPORT_NONE, // rtcpMode
+ rtcpMode,
localRTPPort);
if (err != OK) {
@@ -345,6 +341,22 @@ void MediaSender::onSenderNotify(const sp<AMessage> &msg) {
break;
}
+ case kWhatInformSender:
+ {
+ int64_t avgLatencyUs;
+ CHECK(msg->findInt64("avgLatencyUs", &avgLatencyUs));
+
+ int64_t maxLatencyUs;
+ CHECK(msg->findInt64("maxLatencyUs", &maxLatencyUs));
+
+ sp<AMessage> notify = mNotify->dup();
+ notify->setInt32("what", kWhatInformSender);
+ notify->setInt64("avgLatencyUs", avgLatencyUs);
+ notify->setInt64("maxLatencyUs", maxLatencyUs);
+ notify->post();
+ break;
+ }
+
default:
TRESPASS();
}