Remove dead download code
This commit is contained in:
parent
492ef74459
commit
ec71dc3c6d
|
@ -101,7 +101,7 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
|
||||||
throw new ProcessExitedUncleanException("Couldn't spawn FFmpeg");
|
throw new ProcessExitedUncleanException("Couldn't spawn FFmpeg");
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("Starting to download segments");
|
LOG.debug("Starting to download segments");
|
||||||
startDownloadLoop(segments, true);
|
startDownloadLoop(segments);
|
||||||
ffmpegThread.join();
|
ffmpegThread.join();
|
||||||
LOG.debug("FFmpeg thread terminated");
|
LOG.debug("FFmpeg thread terminated");
|
||||||
}
|
}
|
||||||
|
@ -168,10 +168,10 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
|
||||||
return OS.getFFmpegCommand(argsPlusFile);
|
return OS.getFFmpegCommand(argsPlusFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startDownloadLoop(String segmentPlaylistUri, boolean livestreamDownload) throws IOException, ParseException, PlaylistException {
|
protected void startDownloadLoop(String segmentPlaylistUri) throws IOException, ParseException, PlaylistException {
|
||||||
while (running) {
|
while (running) {
|
||||||
try {
|
try {
|
||||||
downloadSegments(segmentPlaylistUri, livestreamDownload);
|
downloadSegments(segmentPlaylistUri);
|
||||||
} catch (HttpException e) {
|
} catch (HttpException e) {
|
||||||
logHttpException(e);
|
logHttpException(e);
|
||||||
running = false;
|
running = false;
|
||||||
|
@ -186,17 +186,13 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
|
||||||
ffmpegThread.interrupt();
|
ffmpegThread.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadSegments(String segmentPlaylistUri, boolean livestreamDownload) throws IOException, ParseException, PlaylistException, ExecutionException {
|
private void downloadSegments(String segmentPlaylistUri) throws IOException, ParseException, PlaylistException, ExecutionException {
|
||||||
SegmentPlaylist lsp = getNextSegments(segmentPlaylistUri);
|
SegmentPlaylist lsp = getNextSegments(segmentPlaylistUri);
|
||||||
emptyPlaylistCheck(lsp);
|
emptyPlaylistCheck(lsp);
|
||||||
|
|
||||||
// download new segments
|
// download new segments
|
||||||
long downloadStart = System.currentTimeMillis();
|
long downloadStart = System.currentTimeMillis();
|
||||||
if (livestreamDownload) {
|
downloadNewSegments(lsp, nextSegment);
|
||||||
downloadNewSegments(lsp, nextSegment);
|
|
||||||
} else {
|
|
||||||
downloadRecording(lsp);
|
|
||||||
}
|
|
||||||
long downloadTookMillis = System.currentTimeMillis() - downloadStart;
|
long downloadTookMillis = System.currentTimeMillis() - downloadStart;
|
||||||
|
|
||||||
// download segments, which might have been skipped
|
// download segments, which might have been skipped
|
||||||
|
@ -205,17 +201,13 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
|
||||||
downloadTookMillis, lsp.totalDuration);
|
downloadTookMillis, lsp.totalDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (livestreamDownload) {
|
splitRecordingIfNecessary();
|
||||||
splitRecordingIfNecessary();
|
|
||||||
|
|
||||||
// wait some time until requesting the segment playlist again to not hammer the server
|
// wait some time until requesting the segment playlist again to not hammer the server
|
||||||
waitForNewSegments(lsp, lastSegment, downloadTookMillis);
|
waitForNewSegments(lsp, lastSegment, downloadTookMillis);
|
||||||
|
|
||||||
lastSegment = lsp.seq;
|
lastSegment = lsp.seq;
|
||||||
nextSegment = lastSegment + lsp.segments.size();
|
nextSegment = lastSegment + lsp.segments.size();
|
||||||
} else {
|
|
||||||
running = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logHttpException(HttpException e) {
|
private void logHttpException(HttpException e) {
|
||||||
|
@ -234,15 +226,6 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadRecording(SegmentPlaylist lsp) throws IOException {
|
|
||||||
for (String segment : lsp.segments) {
|
|
||||||
URL segmentUrl = new URL(segment);
|
|
||||||
SegmentDownload segmentDownload = new SegmentDownload(lsp, segmentUrl, client);
|
|
||||||
byte[] segmentData = segmentDownload.call();
|
|
||||||
writeSegment(segmentData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void downloadNewSegments(SegmentPlaylist lsp, int nextSegment) throws ExecutionException, IOException {
|
private void downloadNewSegments(SegmentPlaylist lsp, int nextSegment) throws ExecutionException, IOException {
|
||||||
int skip = nextSegment - lsp.seq;
|
int skip = nextSegment - lsp.seq;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ShowupMergedDownload extends MergedFfmpegHlsDownload {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startDownloadLoop(String segmentPlaylistUri, boolean livestreamDownload) throws IOException, ParseException, PlaylistException {
|
protected void startDownloadLoop(String segmentPlaylistUri) throws IOException, ParseException, PlaylistException {
|
||||||
try {
|
try {
|
||||||
SegmentPlaylist lsp = getNextSegments(segmentPlaylistUri);
|
SegmentPlaylist lsp = getNextSegments(segmentPlaylistUri);
|
||||||
emptyPlaylistCheck(lsp);
|
emptyPlaylistCheck(lsp);
|
||||||
|
@ -48,9 +48,7 @@ public class ShowupMergedDownload extends MergedFfmpegHlsDownload {
|
||||||
BandwidthMeter.add(length);
|
BandwidthMeter.add(length);
|
||||||
writeSegment(buffer, 0, length);
|
writeSegment(buffer, 0, length);
|
||||||
keepGoing = running && !Thread.interrupted() && model.isOnline(true);
|
keepGoing = running && !Thread.interrupted() && model.isOnline(true);
|
||||||
if (livestreamDownload) {
|
splitRecordingIfNecessary();
|
||||||
splitRecordingIfNecessary();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new HttpException(response.code(), response.message());
|
throw new HttpException(response.code(), response.message());
|
||||||
|
|
Loading…
Reference in New Issue