Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The solution of some mp3 unable to decode | 一些mp3无法解码的解决办法 #1

Open
xiangyuecn opened this issue Dec 20, 2022 · 0 comments

Comments

@xiangyuecn
Copy link

Look here | 这里:

mp3worker/mp3worker.js

Lines 1943 to 1948 in 02214b1

_mp3_decode();
sampleCount = context[5];
if (!sampleCount) break;
offset += context[6];

Modify to | 修改成:

_mp3_decode();

sampleCount = context[5];
offset += context[6];
if (!sampleCount) {
	if(!context[6]){
		break; //No more mp3 data to decode | 没有更多解码的数据了
	}
	continue; //Need more mp3 data to decode | 需要更多mp3数据才能解码
}

Today, I tested several js versions of MP3 decoding libraries. This code can run through and is very efficient. However, the test found that some mp3s could not be decoded (independent of the channelCount and sampleRate). After studying the code, I found that there seemed to be a problem in this area. It was too early to exit, so I modified it. All mp3 passed the test. The test coverage range: sampleRate 16-48khz, channelCount 1-2.

今天测试了几个js版的mp3解码库,这个代码能跑通,并且效率很高,但测试发现部分mp3无法解码(和采样率声道数无关),研究了一下代码,发现这个地方似乎有点问题,退出的太早了,所以修改了一下,所有mp3都通过了测试,测试覆盖范围:采样率16-48khz,声道数1-2。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant