Skip to content

Make Ogg FormatReader work for partial MediaSourceStreams #374

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1c3t3a
Copy link

@1c3t3a 1c3t3a commented Apr 22, 2025

At the moment, the Ogg FormatReader assumes a complete MediaSourceStream, which allows to seek to the last page. This assumption breaks for partial decodes (MediaSourceStream::Read may return UnexpectedEof multiple times and then continues to fetch data that is available on the next call). This patch allows decoding in chunks, similar to libogg behavior.

Concretely this means:

  1. When reading from a MediaSourceStream, we sync back to the last healthy
    position when experiencing an UnexpectedEof.
  2. If the last page was not present when initializing the format reader,
    we compute the end_delay when reaching the last page.

cc: @jakos-sec

@1c3t3a 1c3t3a force-pushed the remember-ogg-page-position branch from d471298 to 14b22d7 Compare April 22, 2025 12:07
At the moment, the Ogg FormatReader assumes a complete
MediaSourceStream, which allows to seek to the last page.
This assumption breaks for partial decodes (MediaSourceStream::Read may
return UnexpectedEof multiple times and then continues to fetch data
that is available on the next call). This patch allows decoding in chunks,
similar to libogg behavior.

Concretely this means:
1. When reading from a MediaSourceStream, we sync back to the last healthy
   position when experiencing an UnexpectedEof.
2. If the last page was not present when initializing the format reader,
   we compute the end_delay when reaching the last page.

Co-authored-by: Jakob Koschel <jakobkoschel@google.com>
@1c3t3a 1c3t3a force-pushed the remember-ogg-page-position branch from 14b22d7 to 09b0567 Compare April 24, 2025 13:51
@1c3t3a 1c3t3a changed the title Sync ogg format reader to last healthy position in case of an error Make Ogg FormatReader work for partial MediaSourceStreams Apr 24, 2025
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.

1 participant