private void handleSegmentDownloaded(SegmentDownloader.DownloadFinishedArgs args) {
            try {
                handleSegment(args.data, args.cachedSegment);

                mAdaptationLogic.reportSegmentDownload(mAdaptationSet, args.cachedSegment.representation,
                        args.cachedSegment.segment, args.data.length, args.duration);

                mFutureCache.put(args.cachedSegment.number, args.cachedSegment);

                Log.d(TAG, "async cached " + args.cachedSegment.number + " "
                        + args.cachedSegment.segment.toString() + " -> " + args.cachedSegment.file.getPath());

                synchronized (mFutureCache) {
                    mFutureCache.notify();
                }
            } catch (IOException | NullPointerException | IndexOutOfBoundsException e) {
                // TODO handle error?
                // TODO find out why isoparser sometimes throws a NPE or IOOBE
                Log.e(TAG, "segment download failed", e);
            }
        }
Handles a segment by merging it with the init segment into a temporary file.
MediaPlayer-DASH/src/main/java/net/protyposis/android/mediaplayer/dash/DashMediaExtractor.java