commit
* rebase fixup, add null check * better ETA string * drop connection read timeout, for HSDPA networks * bump NPE version
This commit is contained in:
parent
0033843bc2
commit
84ec320df4
|
@ -62,7 +62,7 @@ dependencies {
|
||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
})
|
})
|
||||||
|
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:5c420340ceb39'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:b6d3252'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.23.0'
|
testImplementation 'org.mockito:mockito-core:2.23.0'
|
||||||
|
|
||||||
|
|
|
@ -780,7 +780,7 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
|
||||||
|
|
||||||
if (selectedStream.getFormat() == MediaFormat.M4A) {
|
if (selectedStream.getFormat() == MediaFormat.M4A) {
|
||||||
psName = Postprocessing.ALGORITHM_M4A_NO_DASH;
|
psName = Postprocessing.ALGORITHM_M4A_NO_DASH;
|
||||||
} else if (selectedStream.getFormat() == MediaFormat.OPUS) {
|
} else if (selectedStream.getFormat() == MediaFormat.WEBMA_OPUS) {
|
||||||
psName = Postprocessing.ALGORITHM_OGG_FROM_WEBM_DEMUXER;
|
psName = Postprocessing.ALGORITHM_OGG_FROM_WEBM_DEMUXER;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -228,7 +228,6 @@ public class DownloadMission extends Mission {
|
||||||
|
|
||||||
// BUG workaround: switching between networks can freeze the download forever
|
// BUG workaround: switching between networks can freeze the download forever
|
||||||
conn.setConnectTimeout(30000);
|
conn.setConnectTimeout(30000);
|
||||||
conn.setReadTimeout(10000);
|
|
||||||
|
|
||||||
if (rangeStart >= 0) {
|
if (rangeStart >= 0) {
|
||||||
String req = "bytes=" + rangeStart + "-";
|
String req = "bytes=" + rangeStart + "-";
|
||||||
|
@ -316,7 +315,7 @@ public class DownloadMission extends Mission {
|
||||||
public synchronized void notifyError(int code, Exception err) {
|
public synchronized void notifyError(int code, Exception err) {
|
||||||
Log.e(TAG, "notifyError() code = " + code, err);
|
Log.e(TAG, "notifyError() code = " + code, err);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
if (err.getCause() instanceof ErrnoException) {
|
if (err != null && err.getCause() instanceof ErrnoException) {
|
||||||
int errno = ((ErrnoException) err.getCause()).errno;
|
int errno = ((ErrnoException) err.getCause()).errno;
|
||||||
if (errno == OsConstants.ENOSPC) {
|
if (errno == OsConstants.ENOSPC) {
|
||||||
code = ERROR_INSUFFICIENT_STORAGE;
|
code = ERROR_INSUFFICIENT_STORAGE;
|
||||||
|
|
|
@ -308,10 +308,10 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
||||||
etaStr = "";
|
etaStr = "";
|
||||||
} else {
|
} else {
|
||||||
long eta = (long) Math.ceil((length - done) / averageSpeed);
|
long eta = (long) Math.ceil((length - done) / averageSpeed);
|
||||||
etaStr = " @ ".concat(Utility.stringifySeconds(eta));
|
etaStr = Utility.formatBytes((long) done) + "/" + Utility.stringifySeconds(eta) + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
h.size.setText(sizeStr.concat(speedStr).concat(etaStr));
|
h.size.setText(sizeStr.concat(etaStr).concat(speedStr));
|
||||||
|
|
||||||
h.lastTimestamp = now;
|
h.lastTimestamp = now;
|
||||||
h.lastDone = done;
|
h.lastDone = done;
|
||||||
|
|
Loading…
Reference in New Issue