diff options
author | Andreas Huber <andih@google.com> | 2013-03-25 15:46:52 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2013-03-25 16:20:26 -0700 |
commit | 2aea9552aeba92bbaf9e56c666049ea2d14057b5 (patch) | |
tree | fc3cdb049837a7bdd7452620b9b596aad2c831d3 /media/libstagefright/wifi-display/rtp/RTPReceiver.cpp | |
parent | f90debb467a0daf5288e7d8684642ef1119c4bad (diff) | |
download | frameworks_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/rtp/RTPReceiver.cpp')
-rw-r--r-- | media/libstagefright/wifi-display/rtp/RTPReceiver.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/media/libstagefright/wifi-display/rtp/RTPReceiver.cpp b/media/libstagefright/wifi-display/rtp/RTPReceiver.cpp index c55e0be..238fb82 100644 --- a/media/libstagefright/wifi-display/rtp/RTPReceiver.cpp +++ b/media/libstagefright/wifi-display/rtp/RTPReceiver.cpp @@ -567,8 +567,18 @@ status_t RTPReceiver::connect( return OK; } -status_t RTPReceiver::notifyLateness(int64_t latenessUs) { - sp<ABuffer> buf = new ABuffer(20); +status_t RTPReceiver::informSender(const sp<AMessage> ¶ms) { + if (!mRTCPConnected) { + return INVALID_OPERATION; + } + + int64_t avgLatencyUs; + CHECK(params->findInt64("avgLatencyUs", &avgLatencyUs)); + + int64_t maxLatencyUs; + CHECK(params->findInt64("maxLatencyUs", &maxLatencyUs)); + + sp<ABuffer> buf = new ABuffer(28); uint8_t *ptr = buf->data(); ptr[0] = 0x80 | 0; @@ -587,14 +597,23 @@ status_t RTPReceiver::notifyLateness(int64_t latenessUs) { ptr[10] = 't'; ptr[11] = 'e'; - ptr[12] = latenessUs >> 56; - ptr[13] = (latenessUs >> 48) & 0xff; - ptr[14] = (latenessUs >> 40) & 0xff; - ptr[15] = (latenessUs >> 32) & 0xff; - ptr[16] = (latenessUs >> 24) & 0xff; - ptr[17] = (latenessUs >> 16) & 0xff; - ptr[18] = (latenessUs >> 8) & 0xff; - ptr[19] = latenessUs & 0xff; + ptr[12] = avgLatencyUs >> 56; + ptr[13] = (avgLatencyUs >> 48) & 0xff; + ptr[14] = (avgLatencyUs >> 40) & 0xff; + ptr[15] = (avgLatencyUs >> 32) & 0xff; + ptr[16] = (avgLatencyUs >> 24) & 0xff; + ptr[17] = (avgLatencyUs >> 16) & 0xff; + ptr[18] = (avgLatencyUs >> 8) & 0xff; + ptr[19] = avgLatencyUs & 0xff; + + ptr[20] = maxLatencyUs >> 56; + ptr[21] = (maxLatencyUs >> 48) & 0xff; + ptr[22] = (maxLatencyUs >> 40) & 0xff; + ptr[23] = (maxLatencyUs >> 32) & 0xff; + ptr[24] = (maxLatencyUs >> 24) & 0xff; + ptr[25] = (maxLatencyUs >> 16) & 0xff; + ptr[26] = (maxLatencyUs >> 8) & 0xff; + ptr[27] = maxLatencyUs & 0xff; mNetSession->sendRequest(mRTCPSessionID, buf->data(), buf->size()); |