[YouTube] Improve download speed (#9948)
This commit is contained in:
parent
ed1781133c
commit
fb00ee8cf9
2 changed files with 28 additions and 7 deletions
|
|
@ -54,12 +54,12 @@ public class DownloadInitializer extends Thread {
|
|||
long lowestSize = Long.MAX_VALUE;
|
||||
|
||||
for (int i = 0; i < mMission.urls.length && mMission.running; i++) {
|
||||
mConn = mMission.openConnection(mMission.urls[i], true, -1, -1);
|
||||
mConn = mMission.openConnection(mMission.urls[i], true, 0, 0);
|
||||
mMission.establishConnection(mId, mConn);
|
||||
dispose();
|
||||
|
||||
if (Thread.interrupted()) return;
|
||||
long length = Utility.getContentLength(mConn);
|
||||
long length = Utility.getTotalContentLength(mConn);
|
||||
|
||||
if (i == 0) {
|
||||
httpCode = mConn.getResponseCode();
|
||||
|
|
@ -84,14 +84,14 @@ public class DownloadInitializer extends Thread {
|
|||
}
|
||||
} else {
|
||||
// ask for the current resource length
|
||||
mConn = mMission.openConnection(true, -1, -1);
|
||||
mConn = mMission.openConnection(true, 0, 0);
|
||||
mMission.establishConnection(mId, mConn);
|
||||
dispose();
|
||||
|
||||
if (!mMission.running || Thread.interrupted()) return;
|
||||
|
||||
httpCode = mConn.getResponseCode();
|
||||
mMission.length = Utility.getContentLength(mConn);
|
||||
mMission.length = Utility.getTotalContentLength(mConn);
|
||||
}
|
||||
|
||||
if (mMission.length == 0 || httpCode == 204) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue