For each new MediaCodec should create a new AndroidSurfaceTexture #496
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.