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

FlacExtractor vs LibflacAudioRenderer #6392

Closed
kgrevehagen opened this issue Sep 5, 2019 · 2 comments
Closed

FlacExtractor vs LibflacAudioRenderer #6392

kgrevehagen opened this issue Sep 5, 2019 · 2 comments
Assignees
Labels

Comments

@kgrevehagen
Copy link

[REQUIRED] Searched documentation and issues

GitHub issues, ExoPlayer dev site, Stack Overflow, ExoPlayer javadoc, Github extension flac README.

[REQUIRED] Question

In the ExoPlayer Flac Extension README.md under the headline Using the extension it explains how to use the flac extension using the FlacExtractor and/or LibflacAudioRenderer, but it doesn't say when to use one or the other or both.

Can you explain the differences between these two and when we should use them?
I also have to note that I haven't gotten the LibflacAudioRenderer to work. Maybe the README should be updated to include this information?

There is also a possibility(as I understand it) to play FLAC using ffmpeg. In what circumstances would we go for that approach instead?

A full bug report captured from the device

N/A

Link to test content

N/A

@ojw28
Copy link
Contributor

ojw28 commented Sep 5, 2019

Playing media generally consists of:

  1. Extracting individual samples from the media container (e.g. parsing AAC samples out of MP4)
  2. Decoding the extracted samples (e.g. AAC -> Raw audio)
  3. Rendering the decoded samples

In ExoPlayer the first step is performed by an Extractor and the second step is performed by a decoder, which is part of the Renderer.

FLAC is interesting because it can be placed as samples inside a container like MP4 / Ogg / Matroska, but also defines "native FLAC" in which samples are placed into a very minimalist FLAC defined container. If I remember correctly, the way libFLAC is written makes it easier to perform the first two steps together in the "native FLAC" case. For this reason:

  1. To play native FLAC, you should use FlacExtractor. Because it's easiest to perform the first two steps together using libFLAC, this extractor will actually do step two as well, and output raw audio that the standard audio MediaCodecAudioRenderer can play without needing to further decode it.
  2. To play FLAC that's inside of any other container, you should use whatever the Extractor is for that container to extract the individual samples. For decoding and rendering use LibflacAudioRenderer. From Android 8.1 you can also use the standard MediaCodecAudioRenderer, because there's a FLAC decoder included in the platform on 8.1 and above.

@ojw28
Copy link
Contributor

ojw28 commented Sep 10, 2019

Closing as answered. I also filed #6406, which is related to this issue.

@google google locked and limited conversation to collaborators Nov 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants