Skip to content

Conversation

@vladyslav-arzhanov
Copy link
Contributor

If after the android hw MediaCodec has been initialized we reset the current stream(QAVPlayer::setSource({})) and try to initialize a new one on the same object, we will get a media codec initialization error:

07-06 12:11:07.399 23011 25266 E BufferQueueProducer: [SurfaceTexture-0-23011-0](id:59e300000003,api:3,p:23011,c:23011) connect: already connected (cur=3 req=3) 07-06 12:11:07.399 23011 25266 E SurfaceUtils: Failed to connect to surface 0xbf66e008, err -22 07-06 12:11:07.399 23011 25266 E MediaCodec: nativeWindowConnect returned an error: Invalid argument (-22) 07-06 12:11:07.400 23011 23207 E MediaCodec: configure failed with err 0xffffffea, resetting...

If I understand correctly, this is because we are using the same QAVAndroidSurfaceTexture object
Q_GLOBAL_STATIC(QAVAndroidSurfaceTexture, androidSurfaceTexture);
so we should create a new one for each new QAVHWDevice_MediaCodec object.

@valbok
Copy link
Owner

valbok commented Dec 3, 2024

Thanks for the contribution.

So after this fix, there is no Failed to connect to surface error?

@vladyslav-arzhanov
Copy link
Contributor Author

Yes, when re-initializing the stream on the same object, the error was not reproduced and accordingly the stream also plays validly.

@valbok valbok merged commit e427293 into valbok:master Dec 3, 2024
7 checks passed
@vladyslav-arzhanov vladyslav-arzhanov deleted the reinit_hwmediacodec branch December 3, 2024 11:17
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

Successfully merging this pull request may close these issues.

2 participants