diff options
-rw-r--r-- | src/github/daneren2005/dsub/service/StreamProxy.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/github/daneren2005/dsub/service/StreamProxy.java b/src/github/daneren2005/dsub/service/StreamProxy.java index 78aa7f56..57235030 100644 --- a/src/github/daneren2005/dsub/service/StreamProxy.java +++ b/src/github/daneren2005/dsub/service/StreamProxy.java @@ -165,6 +165,9 @@ public class StreamProxy implements Runnable { return false;
}
+ // Make sure to have file lock
+ downloadFile.setPlaying(true);
+
// Use either partial or complete if downloading finished while StreamProxy was idle
file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile();
@@ -201,9 +204,6 @@ public class StreamProxy implements Runnable { output.write(headers.getBytes());
if(!downloadFile.isWorkDone()) {
- // Make sure have file lock
- downloadFile.setPlaying(true);
-
// Loop as long as there's stuff to send
while (isRunning && !client.isClosed()) {
@@ -240,9 +240,6 @@ public class StreamProxy implements Runnable { Thread.sleep(1000);
}
}
-
- // Release file lock, use of stream proxy means nothing else is using it
- downloadFile.setPlaying(false);
} else {
Log.w(TAG, "Requesting data for completely downloaded file");
}
@@ -261,6 +258,9 @@ public class StreamProxy implements Runnable { output.close();
}
client.close();
+
+ // Release file lock, use of stream proxy means nothing else is using it
+ downloadFile.setPlaying(false);
}
catch (IOException e) {
Log.e(TAG, "IOException while cleaning up streaming task:");
|