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.

Bug: 123862808
Test: rtsp://107.178.217.141:1935/vod/avatar-movie-trailer.mp4

Author: lubiny <lubiny@codeaurora.org>
CRs-Fixed: 650866

Change-Id: I3f9efd9fefa66104ad452559ced5ff5218d73a66
gugelfrei
Dichen Zhang 5 years ago
parent 6a3e785a3e
commit bc9357f513

@ -75,6 +75,8 @@ static int64_t kPauseDelayUs = 3000000ll;
// a new sequence.
static int32_t kMaxAllowedStaleAccessUnits = 20;
static int64_t kTearDownTimeoutUs = 3000000ll;
namespace android {
static bool GetAttribute(const char *s, const char *key, AString *value) {
@ -930,6 +932,14 @@ 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 = reply->dup();
teardown->setInt32("result", -ECONNABORTED);
teardown->post(kTearDownTimeoutUs);
}
break;
}

Loading…
Cancel
Save