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

Opus 1.3.1 crashes on iOS 18. #383

Open
YasinTian opened this issue Dec 12, 2024 · 0 comments
Open

Opus 1.3.1 crashes on iOS 18. #383

YasinTian opened this issue Dec 12, 2024 · 0 comments

Comments

@YasinTian
Copy link

This stack trace looks strange.

Crashed:AURemoteIO::IOThread 
SIGABRT ABORT 0x00000001d42e51d4

0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill + 268
2 libsystem_c.dylib abort + 128
3 TestApp comb_filter + 648012
4 TestApp opus_decoder_destroy + 869644
5 TestApp codecopus.cpp - 第 121 行    CodecOpus::OpusToPcm(unsigned char*, unsigned int, unsigned short*, unsigned int) + 121

This is my decoded code

int32_t CodecOpus::OpusToPcm(uint8_t * bufferOpus, uint32_t opusSize, uint16_t * bufferPcm, uint32_t pcmSize)
{
	int usingFec = 0;
	uint8_t* inputBuffer = bufferOpus;
	int32_t inputSize = opusSize;

    int32_t outputSamples = pcmSize / (2 * _channelCount);
	if (_lastFrameSize != 0) {
		usingFec = 0;
		inputBuffer = _lastFrameBuffer;
		inputSize = _lastFrameSize;
	} else { // last frame has lost
		usingFec = 1; // use current frame to recover last frame(using fec)
		outputSamples = _samplesPerFrame;
	}
	int32_t decodeResult = opus_decode(_decState, (const uint8_t *)inputBuffer, inputSize, (int16_t *)bufferPcm, outputSamples, usingFec);
	if (bufferOpus != NULL && opusSize <= kOpusMaxFrameSize && opusSize > 0) {
		memcpy(_lastFrameBuffer, bufferOpus, opusSize);
		_lastFrameSize = opusSize;
	} else {
		_lastFrameSize = 0;
	}

	if (decodeResult > 0) {
		return decodeResult * 2 * _channelCount;
	}
	return decodeResult;
}
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