aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-03-26 20:19:09 -0700
committerScott Jackson <daneren2005@gmail.com>2013-03-26 20:19:09 -0700
commit8033605b0c6ddb00f123ba6e0306d26bd3baf311 (patch)
tree42edbfc2d12f637eb367dd9055de5d8ac6598414 /subsonic-android/src
parentd872fb27ab938443e6241ea10175fd46776b105b (diff)
downloaddsub-8033605b0c6ddb00f123ba6e0306d26bd3baf311.tar.gz
dsub-8033605b0c6ddb00f123ba6e0306d26bd3baf311.tar.bz2
dsub-8033605b0c6ddb00f123ba6e0306d26bd3baf311.zip
Use Thread instead of AsyncTask since it just doesn't run sometimes
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/StreamProxy.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/StreamProxy.java b/subsonic-android/src/github/daneren2005/dsub/service/StreamProxy.java
index fd940334..17399ee8 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/StreamProxy.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/StreamProxy.java
@@ -71,7 +71,6 @@ public class StreamProxy implements Runnable {
@Override
public void run() {
- Looper.prepare();
isRunning = true;
while (isRunning) {
try {
@@ -83,7 +82,7 @@ public class StreamProxy implements Runnable {
StreamToMediaPlayerTask task = new StreamToMediaPlayerTask(client);
if (task.processRequest()) {
- task.execute();
+ new Thread(task).start();
}
} catch (SocketTimeoutException e) {
@@ -91,14 +90,11 @@ public class StreamProxy implements Runnable {
} catch (IOException e) {
Log.e(TAG, "Error connecting to client", e);
}
-
- // Prevent heavy CPU pegging
- Thread.sleep(100);
}
Log.i(TAG, "Proxy interrupted. Shutting down.");
}
- private class StreamToMediaPlayerTask extends AsyncTask<String, Void, Integer> {
+ private class StreamToMediaPlayerTask implements Runnable {
String localPath;
Socket client;
@@ -162,7 +158,7 @@ public class StreamProxy implements Runnable {
}
@Override
- protected Integer doInBackground(String... params) {
+ public void run() {
Log.i(TAG, "Streaming song in background");
DownloadFile downloadFile = downloadService.getCurrentPlaying();
MusicDirectory.Entry song = downloadFile.getSong();
@@ -244,8 +240,6 @@ public class StreamProxy implements Runnable {
Log.e(TAG, "IOException while cleaning up streaming task:");
Log.e(TAG, e.getClass().getName() + " : " + e.getLocalizedMessage());
}
-
- return 1;
}
}
}