public AudioFrame nextFrame() throws IOException {
        AudioFrame frame = null;
        while (!endOfStream && frame == null) {
            findFrameSyncByte();
            if (!endOfStream) {
                HeaderBitField headerField = createHeaderField();
                if (!endOfStream) {
                    frame = createHeader(headerField);
                    if (frame == null) {
                        pushBack(headerField);
                    }
                }
            }
        }

        currentHeader = frame;
        return frame;
    }
Searches for the next MPEG frame header from the current stream position
on. This method advances the underlying input stream until it finds a
valid frame header or the end of the stream is reached. In the former
case a corresponding {@code AudioFrame} object is created. In the latter
case there are no more headers, so the end of the stream is probably
reached.

@return the next {@code AudioFrame} or <b>null</b>
@throws IOException if an IO error occurs
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/mp3/MpegStream.java