Loading media/libstagefright/wifi-display/ANetworkSession.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -565,7 +565,7 @@ status_t ANetworkSession::Session::writeMore() { mSawSendFailure = true; mSawSendFailure = true; } } #if 1 #if 0 int numBytesQueued; int numBytesQueued; int res = ioctl(mSocket, SIOCOUTQ, &numBytesQueued); int res = ioctl(mSocket, SIOCOUTQ, &numBytesQueued); if (res == 0 && numBytesQueued > 50 * 1024) { if (res == 0 && numBytesQueued > 50 * 1024) { Loading @@ -576,7 +576,7 @@ status_t ANetworkSession::Session::writeMore() { int64_t nowUs = ALooper::GetNowUs(); int64_t nowUs = ALooper::GetNowUs(); if (mLastStallReportUs < 0ll if (mLastStallReportUs < 0ll || nowUs > mLastStallReportUs + 500000ll) { || nowUs > mLastStallReportUs + 100000ll) { sp<AMessage> msg = mNotify->dup(); sp<AMessage> msg = mNotify->dup(); msg->setInt32("sessionID", mSessionID); msg->setInt32("sessionID", mSessionID); msg->setInt32("reason", kWhatNetworkStall); msg->setInt32("reason", kWhatNetworkStall); Loading media/libstagefright/wifi-display/MediaSender.cpp +22 −10 Original line number Original line Diff line number Diff line Loading @@ -85,10 +85,11 @@ ssize_t MediaSender::addTrack(const sp<AMessage> &format, uint32_t flags) { status_t MediaSender::initAsync( status_t MediaSender::initAsync( ssize_t trackIndex, ssize_t trackIndex, RTPSender::TransportMode transportMode, const char *remoteHost, const char *remoteHost, int32_t remoteRTPPort, int32_t remoteRTPPort, RTPSender::TransportMode rtpMode, int32_t remoteRTCPPort, int32_t remoteRTCPPort, RTPSender::TransportMode rtcpMode, int32_t *localRTPPort) { int32_t *localRTPPort) { if (trackIndex < 0) { if (trackIndex < 0) { if (mMode != MODE_UNDEFINED) { if (mMode != MODE_UNDEFINED) { Loading Loading @@ -126,12 +127,9 @@ status_t MediaSender::initAsync( err = mTSSender->initAsync( err = mTSSender->initAsync( remoteHost, remoteHost, remoteRTPPort, remoteRTPPort, transportMode, // rtpMode rtpMode, remoteRTCPPort, remoteRTCPPort, (transportMode == RTPSender::TRANSPORT_UDP rtcpMode, && remoteRTCPPort >= 0) ? transportMode : RTPSender::TRANSPORT_NONE, // rtcpMode localRTPPort); localRTPPort); if (err != OK) { if (err != OK) { Loading Loading @@ -180,11 +178,9 @@ status_t MediaSender::initAsync( status_t err = info->mSender->initAsync( status_t err = info->mSender->initAsync( remoteHost, remoteHost, remoteRTPPort, remoteRTPPort, transportMode, // rtpMode rtpMode, remoteRTCPPort, remoteRTCPPort, (transportMode == RTPSender::TRANSPORT_UDP && remoteRTCPPort >= 0) rtcpMode, ? transportMode : RTPSender::TRANSPORT_NONE, // rtcpMode localRTPPort); localRTPPort); if (err != OK) { if (err != OK) { Loading Loading @@ -345,6 +341,22 @@ void MediaSender::onSenderNotify(const sp<AMessage> &msg) { break; 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: default: TRESPASS(); TRESPASS(); } } Loading media/libstagefright/wifi-display/MediaSender.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ struct MediaSender : public AHandler { kWhatInitDone, kWhatInitDone, kWhatError, kWhatError, kWhatNetworkStall, kWhatNetworkStall, kWhatInformSender, }; }; MediaSender( MediaSender( Loading @@ -59,10 +60,11 @@ struct MediaSender : public AHandler { // If trackIndex == -1, initialize for transport stream muxing. // If trackIndex == -1, initialize for transport stream muxing. status_t initAsync( status_t initAsync( ssize_t trackIndex, ssize_t trackIndex, RTPSender::TransportMode transportMode, const char *remoteHost, const char *remoteHost, int32_t remoteRTPPort, int32_t remoteRTPPort, RTPSender::TransportMode rtpMode, int32_t remoteRTCPPort, int32_t remoteRTCPPort, RTPSender::TransportMode rtcpMode, int32_t *localRTPPort); int32_t *localRTPPort); status_t queueAccessUnit( status_t queueAccessUnit( Loading media/libstagefright/wifi-display/rtp/RTPSender.cpp +18 −2 Original line number Original line Diff line number Diff line Loading @@ -91,8 +91,8 @@ status_t RTPSender::initAsync( CHECK_NE(rtpMode, TRANSPORT_TCP_INTERLEAVED); CHECK_NE(rtpMode, TRANSPORT_TCP_INTERLEAVED); CHECK_NE(rtcpMode, TRANSPORT_TCP_INTERLEAVED); CHECK_NE(rtcpMode, TRANSPORT_TCP_INTERLEAVED); if (rtcpMode == TRANSPORT_NONE && remoteRTCPPort >= 0 if ((rtcpMode == TRANSPORT_NONE && remoteRTCPPort >= 0) || rtcpMode != TRANSPORT_NONE && remoteRTCPPort < 0) { || (rtcpMode != TRANSPORT_NONE && remoteRTCPPort < 0)) { return INVALID_OPERATION; return INVALID_OPERATION; } } Loading Loading @@ -616,6 +616,7 @@ status_t RTPSender::onRTCPData(const sp<ABuffer> &buffer) { break; break; case 204: // APP case 204: // APP parseAPP(data, headerLength); break; break; case 205: // TSFB (transport layer specific feedback) case 205: // TSFB (transport layer specific feedback) Loading Loading @@ -721,6 +722,21 @@ status_t RTPSender::parseTSFB(const uint8_t *data, size_t size) { return OK; 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) { void RTPSender::notifyInitDone(status_t err) { sp<AMessage> notify = mNotify->dup(); sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatInitDone); notify->setInt32("what", kWhatInitDone); Loading media/libstagefright/wifi-display/rtp/RTPSender.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ struct RTPSender : public RTPBase, public AHandler { kWhatInitDone, kWhatInitDone, kWhatError, kWhatError, kWhatNetworkStall, kWhatNetworkStall, kWhatInformSender, }; }; RTPSender( RTPSender( const sp<ANetworkSession> &netSession, const sp<ANetworkSession> &netSession, Loading Loading @@ -105,6 +106,7 @@ private: status_t onRTCPData(const sp<ABuffer> &data); status_t onRTCPData(const sp<ABuffer> &data); status_t parseReceiverReport(const uint8_t *data, size_t size); status_t parseReceiverReport(const uint8_t *data, size_t size); status_t parseTSFB(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 notifyInitDone(status_t err); void notifyError(status_t err); void notifyError(status_t err); Loading Loading
media/libstagefright/wifi-display/ANetworkSession.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -565,7 +565,7 @@ status_t ANetworkSession::Session::writeMore() { mSawSendFailure = true; mSawSendFailure = true; } } #if 1 #if 0 int numBytesQueued; int numBytesQueued; int res = ioctl(mSocket, SIOCOUTQ, &numBytesQueued); int res = ioctl(mSocket, SIOCOUTQ, &numBytesQueued); if (res == 0 && numBytesQueued > 50 * 1024) { if (res == 0 && numBytesQueued > 50 * 1024) { Loading @@ -576,7 +576,7 @@ status_t ANetworkSession::Session::writeMore() { int64_t nowUs = ALooper::GetNowUs(); int64_t nowUs = ALooper::GetNowUs(); if (mLastStallReportUs < 0ll if (mLastStallReportUs < 0ll || nowUs > mLastStallReportUs + 500000ll) { || nowUs > mLastStallReportUs + 100000ll) { sp<AMessage> msg = mNotify->dup(); sp<AMessage> msg = mNotify->dup(); msg->setInt32("sessionID", mSessionID); msg->setInt32("sessionID", mSessionID); msg->setInt32("reason", kWhatNetworkStall); msg->setInt32("reason", kWhatNetworkStall); Loading
media/libstagefright/wifi-display/MediaSender.cpp +22 −10 Original line number Original line Diff line number Diff line Loading @@ -85,10 +85,11 @@ ssize_t MediaSender::addTrack(const sp<AMessage> &format, uint32_t flags) { status_t MediaSender::initAsync( status_t MediaSender::initAsync( ssize_t trackIndex, ssize_t trackIndex, RTPSender::TransportMode transportMode, const char *remoteHost, const char *remoteHost, int32_t remoteRTPPort, int32_t remoteRTPPort, RTPSender::TransportMode rtpMode, int32_t remoteRTCPPort, int32_t remoteRTCPPort, RTPSender::TransportMode rtcpMode, int32_t *localRTPPort) { int32_t *localRTPPort) { if (trackIndex < 0) { if (trackIndex < 0) { if (mMode != MODE_UNDEFINED) { if (mMode != MODE_UNDEFINED) { Loading Loading @@ -126,12 +127,9 @@ status_t MediaSender::initAsync( err = mTSSender->initAsync( err = mTSSender->initAsync( remoteHost, remoteHost, remoteRTPPort, remoteRTPPort, transportMode, // rtpMode rtpMode, remoteRTCPPort, remoteRTCPPort, (transportMode == RTPSender::TRANSPORT_UDP rtcpMode, && remoteRTCPPort >= 0) ? transportMode : RTPSender::TRANSPORT_NONE, // rtcpMode localRTPPort); localRTPPort); if (err != OK) { if (err != OK) { Loading Loading @@ -180,11 +178,9 @@ status_t MediaSender::initAsync( status_t err = info->mSender->initAsync( status_t err = info->mSender->initAsync( remoteHost, remoteHost, remoteRTPPort, remoteRTPPort, transportMode, // rtpMode rtpMode, remoteRTCPPort, remoteRTCPPort, (transportMode == RTPSender::TRANSPORT_UDP && remoteRTCPPort >= 0) rtcpMode, ? transportMode : RTPSender::TRANSPORT_NONE, // rtcpMode localRTPPort); localRTPPort); if (err != OK) { if (err != OK) { Loading Loading @@ -345,6 +341,22 @@ void MediaSender::onSenderNotify(const sp<AMessage> &msg) { break; 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: default: TRESPASS(); TRESPASS(); } } Loading
media/libstagefright/wifi-display/MediaSender.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ struct MediaSender : public AHandler { kWhatInitDone, kWhatInitDone, kWhatError, kWhatError, kWhatNetworkStall, kWhatNetworkStall, kWhatInformSender, }; }; MediaSender( MediaSender( Loading @@ -59,10 +60,11 @@ struct MediaSender : public AHandler { // If trackIndex == -1, initialize for transport stream muxing. // If trackIndex == -1, initialize for transport stream muxing. status_t initAsync( status_t initAsync( ssize_t trackIndex, ssize_t trackIndex, RTPSender::TransportMode transportMode, const char *remoteHost, const char *remoteHost, int32_t remoteRTPPort, int32_t remoteRTPPort, RTPSender::TransportMode rtpMode, int32_t remoteRTCPPort, int32_t remoteRTCPPort, RTPSender::TransportMode rtcpMode, int32_t *localRTPPort); int32_t *localRTPPort); status_t queueAccessUnit( status_t queueAccessUnit( Loading
media/libstagefright/wifi-display/rtp/RTPSender.cpp +18 −2 Original line number Original line Diff line number Diff line Loading @@ -91,8 +91,8 @@ status_t RTPSender::initAsync( CHECK_NE(rtpMode, TRANSPORT_TCP_INTERLEAVED); CHECK_NE(rtpMode, TRANSPORT_TCP_INTERLEAVED); CHECK_NE(rtcpMode, TRANSPORT_TCP_INTERLEAVED); CHECK_NE(rtcpMode, TRANSPORT_TCP_INTERLEAVED); if (rtcpMode == TRANSPORT_NONE && remoteRTCPPort >= 0 if ((rtcpMode == TRANSPORT_NONE && remoteRTCPPort >= 0) || rtcpMode != TRANSPORT_NONE && remoteRTCPPort < 0) { || (rtcpMode != TRANSPORT_NONE && remoteRTCPPort < 0)) { return INVALID_OPERATION; return INVALID_OPERATION; } } Loading Loading @@ -616,6 +616,7 @@ status_t RTPSender::onRTCPData(const sp<ABuffer> &buffer) { break; break; case 204: // APP case 204: // APP parseAPP(data, headerLength); break; break; case 205: // TSFB (transport layer specific feedback) case 205: // TSFB (transport layer specific feedback) Loading Loading @@ -721,6 +722,21 @@ status_t RTPSender::parseTSFB(const uint8_t *data, size_t size) { return OK; 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) { void RTPSender::notifyInitDone(status_t err) { sp<AMessage> notify = mNotify->dup(); sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatInitDone); notify->setInt32("what", kWhatInitDone); Loading
media/libstagefright/wifi-display/rtp/RTPSender.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ struct RTPSender : public RTPBase, public AHandler { kWhatInitDone, kWhatInitDone, kWhatError, kWhatError, kWhatNetworkStall, kWhatNetworkStall, kWhatInformSender, }; }; RTPSender( RTPSender( const sp<ANetworkSession> &netSession, const sp<ANetworkSession> &netSession, Loading Loading @@ -105,6 +106,7 @@ private: status_t onRTCPData(const sp<ABuffer> &data); status_t onRTCPData(const sp<ABuffer> &data); status_t parseReceiverReport(const uint8_t *data, size_t size); status_t parseReceiverReport(const uint8_t *data, size_t size); status_t parseTSFB(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 notifyInitDone(status_t err); void notifyError(status_t err); void notifyError(status_t err); Loading