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

AudioTrack: Discontinuity detected when switching from 44.1KHz/24bit to 16bit track #6593

Closed
tomislavturcic opened this issue Oct 29, 2019 · 0 comments
Labels

Comments

@tomislavturcic
Copy link

tomislavturcic commented Oct 29, 2019

Issue description

Using ConcatenatingMedia to play FLAC tracks, an issue appears when switching from 24bit to 16bit source. The 16bit source is overlayed with static and noise. The issue persists when switching to other 16bit sources. Static is gone once we switch to a 24bit source or reset the player.
This only happens for sources that have a sample rate of 44.1KHz.
During the static, following error is repeatedly logged:
AudioTrack: Discontinuity detected [expected 'some value', got 'some other valuej']

EDIT:
After additional investigation, I've found out that LibflacAudioRenderer always returns FORMAT_UNSUPPORTED_TYPE when supportsFormatInternal method is called. That is because format.sampleMimeType is "audio/raw". Therefore FlacDecoder is never created. Any advice?

And for additional info, here's my ExoPlayer construction:

SimpleExoPlayer exoPlayer = ExoPlayerFactory.newSimpleInstance(context, 
                createRenderersFactory(context), 
                new DefaultTrackSelector());
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context, "ExoPlayerTest"));

Creating RenderersFactory instance. (I've tried various options here, all lead to same results).

private RenderersFactory createRenderersFactory(Context context) {
        DefaultRenderersFactory factory = new DefaultRenderersFactory(context);
        factory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER);
        return factory;
}

Creating MediaSources for ConcatenatingMediaSource:

private MediaSource createMediaSource(PlayerTrack track) {
        return new ProgressiveMediaSource.Factory(dataSourceFactory)
                .setTag(track)
                .createMediaSource(Uri.parse(track.url));
}

A full bug report captured from the device

logcat.txt

Version of ExoPlayer being used

ExoPlayerLib/2.10.1 with FLAC extension.

Device(s) and version(s) of Android being used

Samsung S9, Android 9
Pixel XL, Android 10,
LG L-03K, Android 9

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