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

Console Error: "Decoder not configured" #645

Closed
2 tasks done
wushanchao opened this issue Jun 27, 2024 · 2 comments
Closed
2 tasks done

Console Error: "Decoder not configured" #645

wushanchao opened this issue Jun 27, 2024 · 2 comments
Labels
type:bug Something isn't working

Comments

@wushanchao
Copy link

Issue Checklist

  • I'm using the library programmatically
  • For Scrcpy related issues, I have searched in Genymobile/scrcpy repository.

Library version

0.0.21

Environment

win10,ios,android,chrome106

Device

pc, iPhone 17 ,Android 13

Describe the bug

When I disconnect, that is, when I execute the code 'STATE.stop();', the console occasionally throws an error saying 'Decoder not configured'.

Steps to reproduce

other tips

  1. spawn options max_size=1280 max_fps=120 send_device_meta=false send_dummy_byte=false scid=43cac6b2 video_codec_options=profile=1,level=2048 video_encoder=OMX.google.h264.encoder audio=false audio_codec=aac
@wushanchao wushanchao added the type:bug Something isn't working label Jun 27, 2024
@yume-chan
Copy link
Owner

yume-chan commented Jul 1, 2024

Error: "Decoder not configured" means a data packet has arrived before configuration packets.

case "data": {
if (!this.#initializer) {
throw new Error("Decoder not configured");
}

But I believe in this situation, it's a data packet arrived after dispose is called.

dispose(): void {
this.#initializer?.promise
.then((wrapper) => wrapper.dispose())
// NOOP: It's disposed so nobody cares about the error
.catch(NOOP);
this.#initializer = undefined;
}


It's safe to ignore the error, or stop the piping before disposing the decoder:

const abortController = new AbortController();
const decoder = new TinyH264Decoder();
videoStream
    // .pipeThrough inspect stream to get video size
    .pipeTo(decoder.writable, {
        signal: abortController.signal,
    })
    .catch((e) => {
        if (abortController.signal.aborted) {
            return;
        }
        console.error(e);
    });

// when stopping
abortController.abort();
decoder.dispose();

@wushanchao
Copy link
Author

3ks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants