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

Library does not work if input stream cannot provide Length #22

Open
Licho1 opened this issue Nov 18, 2023 · 5 comments
Open

Library does not work if input stream cannot provide Length #22

Licho1 opened this issue Nov 18, 2023 · 5 comments

Comments

@Licho1
Copy link

Licho1 commented Nov 18, 2023

Some streams, for example chunked network stream produced by httpclient do not have .Length property. If you try to read this stream, it will crash internally on initialize.

@lostromb
Copy link
Owner

lostromb commented Nov 18, 2023

Stream stream = await new HttpClient().GetStreamAsync("http://durandal.dnsalias.net/goons/casserole.opus");
OpusOggReadStream readStream = new OpusOggReadStream(new OpusDecoder(48000, 2), stream);
readStream.DecodeNextPacket();

Works fine for me? Can you provide repro code?

@lostromb
Copy link
Owner

whoops, never mind. It doesn't throw an exception, but it does stop working....

@lostromb
Copy link
Owner

lostromb commented Nov 18, 2023

Hmmmm yeah, the exception is being thrown from StreamReadBuffer when it's trying to seek to the beginning of a page, on the assumption that the page has been buffered locally from the network. This codebase is forked from NVorbis which has since changed a lot and removed this entire code path.

I don't know if there is a quick fix. The whole point of the buffered intermediate stream seems like it was supposed to make short-term seeking possible, but it doesn't actually work (I didn't write this code)

@Licho1
Copy link
Author

Licho1 commented Nov 20, 2023

whoops, never mind. It doesn't throw an exception, but it does stop working....

Yeah exception is caught internally.. sorry for bad explanation

@lostromb
Copy link
Owner

lostromb commented May 7, 2024

I might have fixed this with #23, but I don't quite remember as that code has been hanging around for a few months and I don't fully remember it.

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

2 participants