@Override
    public MediaFormat getTrackFormat(int index) {
        MediaFormat mediaFormat = super.getTrackFormat(index);
        if(mMp4Mode) {
            /* An MP4 that has been converted from a fragmented to an unfragmented container
             * through the isoparser library does only contain the current segment's runtime. To
             * return the total runtime, we take the value from the MPD instead.
             */
            mediaFormat.setLong(MediaFormat.KEY_DURATION, mMPD.mediaPresentationDurationUs);
        }
        if(mediaFormat.getString(MediaFormat.KEY_MIME).startsWith("video/")) {
            // Return the display aspect ratio as defined in the MPD (can be different from the encoded video size)
            mediaFormat.setFloat(MEDIA_FORMAT_EXTENSION_KEY_DAR,
                    mAdaptationSet.hasPAR() ? mAdaptationSet.par : mRepresentation.calculatePAR());
        }
        return mediaFormat;
    }
Sets the size of the segment cache.
On Android before API 21, the size must be set before setting the data source (which is when the
cache is created), else an exception will be thrown. From Android 21 Lollipop onward,
the cache can be dynamically resized at any time.

Segments that are larger than the cache size will not be cached. Setting a very small cache
size or zero cache size effectively disables caching.

@param sizeInBytes the size of the segment cache in bytes
@throws IllegalStateException on Android before API 21 if the data source has already been set
MediaPlayer-DASH/src/main/java/net/protyposis/android/mediaplayer/dash/DashMediaExtractor.java