summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlubiny <lubiny@codeaurora.org>2014-04-25 18:53:05 +0800
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:24:52 -0600
commit7a14e1c1222408961fb499169ee9745a10c3a2cb (patch)
treec0fa2a34e974607541d9afe1446a615d36d2f77f
parent367a60171c0fbfa0afbea842912d1c36aa888af4 (diff)
downloadframeworks_av-7a14e1c1222408961fb499169ee9745a10c3a2cb.zip
frameworks_av-7a14e1c1222408961fb499169ee9745a10c3a2cb.tar.gz
frameworks_av-7a14e1c1222408961fb499169ee9745a10c3a2cb.tar.bz2
NuPlayer: Fix ANR while resetting RTSP playback
- When network is poor, the response of RTSP teardown won't be received in time, so ANR will happen. - With this patch, a teardown message will be sent when timeout expires, in order to avoid ANR. Change-Id: I3f9efd9fefa66104ad452559ced5ff5218d73a66 CRs-Fixed: 650866
-rw-r--r--media/libstagefright/rtsp/MyHandler.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 2eea5c9..916a67c 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -66,6 +66,8 @@ static int64_t kDefaultKeepAliveTimeoutUs = 60000000ll;
static int64_t kPauseDelayUs = 3000000ll;
+static int64_t kTearDownTimeoutUs = 3000000ll;
+
namespace android {
static bool GetAttribute(const char *s, const char *key, AString *value) {
@@ -944,6 +946,15 @@ struct MyHandler : public AHandler {
request.append("\r\n");
mConn->sendRequest(request.c_str(), reply);
+
+ // If the response of teardown hasn't been received in 3 seconds,
+ // post 'tear' message to avoid ANR.
+ if (!msg->findInt32("reconnect", &reconnect) || !reconnect) {
+ sp<AMessage> teardown = new AMessage('tear', this);
+ teardown->setInt32("result", -ECONNABORTED);
+ teardown->post(kTearDownTimeoutUs);
+ }
+
break;
}