Add loop to get manifest for retries
Try to download the manifest 10 times with a little break in between before giving up causing the download to terminate
This commit is contained in:
parent
c2901284ef
commit
df3e87f1dd
|
@ -81,14 +81,22 @@ public class DashDownload extends AbstractDownload {
|
|||
.header("Connection", "keep-alive")
|
||||
.build(); // @formatter:on
|
||||
LOG.trace("Loading manifest {}", url);
|
||||
// TODO try 10 times
|
||||
try (Response response = httpClient.execute(request)) {
|
||||
if (response.isSuccessful()) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
throw new HttpException(response.code(), "Couldn't load manifest: " + response.message());
|
||||
for (int tries = 1; tries <= 10; tries++) {
|
||||
try (Response response = httpClient.execute(request)) {
|
||||
if (response.isSuccessful()) {
|
||||
return response.body().string();
|
||||
} else {
|
||||
HttpException httpException = new HttpException(response.code(), "Couldn't load manifest: " + response.message());
|
||||
if (tries == 10) {
|
||||
throw httpException;
|
||||
} else {
|
||||
LOG.debug("Couldn't load manifest", httpException);
|
||||
waitSomeTime(100 * tries);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IOException("Couldn't load manifest");
|
||||
}
|
||||
|
||||
private int downloadSegments(MPDtype mpd, AdaptationSetType adaptationSet, boolean isVideo) throws IOException {
|
||||
|
|
Loading…
Reference in New Issue