File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed
Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -279,25 +279,33 @@ void NuCachedSource2::onMessageReceived(const sp<AMessage> &msg) {
279279void NuCachedSource2::fetchInternal () {
280280 LOGV (" fetchInternal" );
281281
282+ bool reconnect = false ;
283+
282284 {
283285 Mutex::Autolock autoLock (mLock );
284286 CHECK (mFinalStatus == OK || mNumRetriesLeft > 0 );
285287
286288 if (mFinalStatus != OK) {
287289 --mNumRetriesLeft ;
288290
289- status_t err =
290- mSource ->reconnectAtOffset (mCacheOffset + mCache ->totalSize ());
291+ reconnect = true ;
292+ }
293+ }
291294
292- if (err == ERROR_UNSUPPORTED) {
293- mNumRetriesLeft = 0 ;
294- return ;
295- } else if (err != OK) {
296- LOGI (" The attempt to reconnect failed, %d retries remaining" ,
297- mNumRetriesLeft );
295+ if (reconnect) {
296+ status_t err =
297+ mSource ->reconnectAtOffset (mCacheOffset + mCache ->totalSize ());
298298
299- return ;
300- }
299+ Mutex::Autolock autoLock (mLock );
300+
301+ if (err == ERROR_UNSUPPORTED) {
302+ mNumRetriesLeft = 0 ;
303+ return ;
304+ } else if (err != OK) {
305+ LOGI (" The attempt to reconnect failed, %d retries remaining" ,
306+ mNumRetriesLeft );
307+
308+ return ;
301309 }
302310 }
303311
You can’t perform that action at this time.
0 commit comments