private static float calculateDuration(int layer, int sampleRate) {
        int sampleCount = (layer == AudioFrame.LAYER_1) ? SAMPLE_COUNT_L1 : SAMPLE_COUNT_L2;
        return (1000.0f / sampleRate) * sampleCount;
    }
Calculates the duration of a MPEG frame based on the given parameters.

@param layer      the layer
@param sampleRate the sample rate
@return the duration of this frame in milliseconds
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/mp3/MpegStream.java