Loading media/libstagefright/wifi-display/source/PlaybackSession.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -822,6 +822,11 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( CHECK(msg->findInt32("err", &err)); ALOGE("converter signaled error %d", err); // Inform WifiDisplaySource of our premature death (wish). sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatSessionDead); notify->post(); } break; } Loading Loading @@ -857,7 +862,7 @@ status_t WifiDisplaySource::PlaybackSession::addSource( pullLooper->start( false /* runOnCallingThread */, false /* canCallJava */, PRIORITY_DEFAULT); PRIORITY_AUDIO); sp<ALooper> codecLooper = new ALooper; codecLooper->setName("codec_looper"); Loading @@ -865,7 +870,7 @@ status_t WifiDisplaySource::PlaybackSession::addSource( codecLooper->start( false /* runOnCallingThread */, false /* canCallJava */, PRIORITY_DEFAULT); PRIORITY_AUDIO); size_t trackIndex; Loading media/libstagefright/wifi-display/source/WifiDisplaySource.cpp +45 −16 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ WifiDisplaySource::WifiDisplaySource( : mNetSession(netSession), mClient(client), mSessionID(0), mStopReplyID(0), mClientSessionID(0), mReaperPending(false), mNextCSeq(1) Loading Loading @@ -232,20 +233,17 @@ void WifiDisplaySource::onMessageReceived(const sp<AMessage> &msg) { uint32_t replyID; CHECK(msg->senderAwaitsResponse(&replyID)); disconnectClient(OK); if (mSessionID != 0 && mClientSessionID != 0) { status_t err = sendM5( mClientSessionID, true /* requestShutdown */); #if REQUIRE_HDCP if (mHDCP != NULL) { mHDCP->shutdownAsync(); mHDCP.clear(); if (err == OK) { mStopReplyID = replyID; break; } } #endif status_t err = OK; sp<AMessage> response = new AMessage; response->setInt32("err", err); response->postReply(replyID); finishStop(replyID); break; } Loading Loading @@ -352,13 +350,15 @@ void WifiDisplaySource::onMessageReceived(const sp<AMessage> &msg) { if (mSetupTriggerDeferred) { mSetupTriggerDeferred = false; sendM5(mClientSessionID); sendM5(mClientSessionID, false /* requestShutdown */); } break; } default: { ALOGE("HDCP failure, shutting down."); disconnectClient(-EACCES); break; } Loading Loading @@ -499,8 +499,15 @@ status_t WifiDisplaySource::sendM4(int32_t sessionID) { return OK; } status_t WifiDisplaySource::sendM5(int32_t sessionID) { AString body = "wfd_trigger_method: SETUP\r\n"; status_t WifiDisplaySource::sendM5(int32_t sessionID, bool requestShutdown) { AString body = "wfd_trigger_method: "; if (requestShutdown) { body.append("TEARDOWN"); } else { body.append("SETUP"); } body.append("\r\n"); AString request = "SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"; AppendCommonResponse(&request, mNextCSeq); Loading Loading @@ -639,7 +646,7 @@ status_t WifiDisplaySource::onReceiveM4Response( } #endif return sendM5(sessionID); return sendM5(sessionID, false /* requestShutdown */); } status_t WifiDisplaySource::onReceiveM5Response( Loading Loading @@ -1073,11 +1080,33 @@ status_t WifiDisplaySource::onTeardownRequest( return err; } if (mStopReplyID != 0) { finishStop(mStopReplyID); mStopReplyID = 0; } else { disconnectClient(UNKNOWN_ERROR); } return OK; } void WifiDisplaySource::finishStop(uint32_t replyID) { disconnectClient(OK); #if REQUIRE_HDCP if (mHDCP != NULL) { mHDCP->shutdownAsync(); mHDCP.clear(); } #endif status_t err = OK; sp<AMessage> response = new AMessage; response->setInt32("err", err); response->postReply(replyID); } status_t WifiDisplaySource::onGetParameterRequest( int32_t sessionID, int32_t cseq, Loading media/libstagefright/wifi-display/source/WifiDisplaySource.h +5 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ private: struct in_addr mInterfaceAddr; int32_t mSessionID; uint32_t mStopReplyID; int32_t mClientSessionID; struct ClientInfo { Loading Loading @@ -123,7 +125,7 @@ private: status_t sendM1(int32_t sessionID); status_t sendM3(int32_t sessionID); status_t sendM4(int32_t sessionID); status_t sendM5(int32_t sessionID); status_t sendM5(int32_t sessionID, bool requestShutdown); status_t sendM16(int32_t sessionID); status_t onReceiveM1Response( Loading Loading @@ -203,6 +205,8 @@ private: // A listener is notified accordingly. void disconnectClient(status_t err); void finishStop(uint32_t replyID); DISALLOW_EVIL_CONSTRUCTORS(WifiDisplaySource); }; Loading Loading
media/libstagefright/wifi-display/source/PlaybackSession.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -822,6 +822,11 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( CHECK(msg->findInt32("err", &err)); ALOGE("converter signaled error %d", err); // Inform WifiDisplaySource of our premature death (wish). sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatSessionDead); notify->post(); } break; } Loading Loading @@ -857,7 +862,7 @@ status_t WifiDisplaySource::PlaybackSession::addSource( pullLooper->start( false /* runOnCallingThread */, false /* canCallJava */, PRIORITY_DEFAULT); PRIORITY_AUDIO); sp<ALooper> codecLooper = new ALooper; codecLooper->setName("codec_looper"); Loading @@ -865,7 +870,7 @@ status_t WifiDisplaySource::PlaybackSession::addSource( codecLooper->start( false /* runOnCallingThread */, false /* canCallJava */, PRIORITY_DEFAULT); PRIORITY_AUDIO); size_t trackIndex; Loading
media/libstagefright/wifi-display/source/WifiDisplaySource.cpp +45 −16 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ WifiDisplaySource::WifiDisplaySource( : mNetSession(netSession), mClient(client), mSessionID(0), mStopReplyID(0), mClientSessionID(0), mReaperPending(false), mNextCSeq(1) Loading Loading @@ -232,20 +233,17 @@ void WifiDisplaySource::onMessageReceived(const sp<AMessage> &msg) { uint32_t replyID; CHECK(msg->senderAwaitsResponse(&replyID)); disconnectClient(OK); if (mSessionID != 0 && mClientSessionID != 0) { status_t err = sendM5( mClientSessionID, true /* requestShutdown */); #if REQUIRE_HDCP if (mHDCP != NULL) { mHDCP->shutdownAsync(); mHDCP.clear(); if (err == OK) { mStopReplyID = replyID; break; } } #endif status_t err = OK; sp<AMessage> response = new AMessage; response->setInt32("err", err); response->postReply(replyID); finishStop(replyID); break; } Loading Loading @@ -352,13 +350,15 @@ void WifiDisplaySource::onMessageReceived(const sp<AMessage> &msg) { if (mSetupTriggerDeferred) { mSetupTriggerDeferred = false; sendM5(mClientSessionID); sendM5(mClientSessionID, false /* requestShutdown */); } break; } default: { ALOGE("HDCP failure, shutting down."); disconnectClient(-EACCES); break; } Loading Loading @@ -499,8 +499,15 @@ status_t WifiDisplaySource::sendM4(int32_t sessionID) { return OK; } status_t WifiDisplaySource::sendM5(int32_t sessionID) { AString body = "wfd_trigger_method: SETUP\r\n"; status_t WifiDisplaySource::sendM5(int32_t sessionID, bool requestShutdown) { AString body = "wfd_trigger_method: "; if (requestShutdown) { body.append("TEARDOWN"); } else { body.append("SETUP"); } body.append("\r\n"); AString request = "SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"; AppendCommonResponse(&request, mNextCSeq); Loading Loading @@ -639,7 +646,7 @@ status_t WifiDisplaySource::onReceiveM4Response( } #endif return sendM5(sessionID); return sendM5(sessionID, false /* requestShutdown */); } status_t WifiDisplaySource::onReceiveM5Response( Loading Loading @@ -1073,11 +1080,33 @@ status_t WifiDisplaySource::onTeardownRequest( return err; } if (mStopReplyID != 0) { finishStop(mStopReplyID); mStopReplyID = 0; } else { disconnectClient(UNKNOWN_ERROR); } return OK; } void WifiDisplaySource::finishStop(uint32_t replyID) { disconnectClient(OK); #if REQUIRE_HDCP if (mHDCP != NULL) { mHDCP->shutdownAsync(); mHDCP.clear(); } #endif status_t err = OK; sp<AMessage> response = new AMessage; response->setInt32("err", err); response->postReply(replyID); } status_t WifiDisplaySource::onGetParameterRequest( int32_t sessionID, int32_t cseq, Loading
media/libstagefright/wifi-display/source/WifiDisplaySource.h +5 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ private: struct in_addr mInterfaceAddr; int32_t mSessionID; uint32_t mStopReplyID; int32_t mClientSessionID; struct ClientInfo { Loading Loading @@ -123,7 +125,7 @@ private: status_t sendM1(int32_t sessionID); status_t sendM3(int32_t sessionID); status_t sendM4(int32_t sessionID); status_t sendM5(int32_t sessionID); status_t sendM5(int32_t sessionID, bool requestShutdown); status_t sendM16(int32_t sessionID); status_t onReceiveM1Response( Loading Loading @@ -203,6 +205,8 @@ private: // A listener is notified accordingly. void disconnectClient(status_t err); void finishStop(uint32_t replyID); DISALLOW_EVIL_CONSTRUCTORS(WifiDisplaySource); }; Loading