mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
Release sample pipelines before asset loaders
The video asset loader renders decoder output to a surface texture, and if the video sample pipeline is in the process of updating the surface texture image at the moment when the asset loader video decoder is released this seems to cause `MediaCodec.release` to get stuck. Swap the release order so that we stop updating the texture before trying to release the codec. PiperOrigin-RevId: 523401619
This commit is contained in:
parent
ba2c32738f
commit
0b40bc37ab
1 changed files with 7 additions and 4 deletions
|
|
@ -343,9 +343,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
boolean releasedPreviously = released;
|
||||
if (!released) {
|
||||
released = true;
|
||||
for (int i = 0; i < sequenceAssetLoaders.size(); i++) {
|
||||
// The video sample pipeline can hold buffers from the asset loader's decoder in a surface
|
||||
// texture, so we release the video sample pipeline first to avoid releasing the codec while
|
||||
// its buffers are pending processing.
|
||||
for (int i = 0; i < samplePipelines.size(); i++) {
|
||||
try {
|
||||
sequenceAssetLoaders.get(i).release();
|
||||
samplePipelines.get(i).release();
|
||||
} catch (RuntimeException e) {
|
||||
if (releaseExportException == null) {
|
||||
releaseExportException = ExportException.createForUnexpected(e);
|
||||
|
|
@ -355,9 +358,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < samplePipelines.size(); i++) {
|
||||
for (int i = 0; i < sequenceAssetLoaders.size(); i++) {
|
||||
try {
|
||||
samplePipelines.get(i).release();
|
||||
sequenceAssetLoaders.get(i).release();
|
||||
} catch (RuntimeException e) {
|
||||
if (releaseExportException == null) {
|
||||
releaseExportException = ExportException.createForUnexpected(e);
|
||||
|
|
|
|||
Loading…
Reference in a new issue