dschmidt opened a new pull request, #2954: URL: https://github.com/apache/tika/pull/2954
Fixes TIKA-4791. MpegStream computed every non-Layer-I frame with the MPEG1 values (144 * bitrate / samplerate bytes, 1152 samples), but MPEG2 and MPEG2.5 Layer III (the low sampling frequency mode of ISO/IEC 13818-3) carry a single granule of 576 samples per frame, so the coefficient is 72. Reference decoders (FFmpeg, mpg123, libmad) all halve these values for LSF streams. The effect on low-samplerate MP3s: the frame walk skipped over the following frame and visited at best every second frame (where the doubled skip landed mid-frame, the sync scan dropped further frames), `AudioFrame.getLength()` and `getDuration()` were wrong by exactly 2x, and while the summed duration nearly cancelled for CBR files, it came out over 10 percent short on 22050 Hz VBR files. Frame length and duration now branch on version and layer. Layer II keeps 1152 samples in every MPEG version and Layer I was already correct, so those paths are unchanged and covered by a guard test. Regression tests cover all four version/layer combinations, plus an end-to-end duration check on a real ffmpeg-encoded 22050 Hz MPEG2 file (79 frames, walked to a clean EOF); the three LSF assertions fail against the previous code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
