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

Looping breaks after several runs #3239

Closed
guness opened this issue Sep 5, 2017 · 1 comment
Closed

Looping breaks after several runs #3239

guness opened this issue Sep 5, 2017 · 1 comment
Assignees

Comments

@guness
Copy link

guness commented Sep 5, 2017

Issue description

I am trying to loop a single video from sdcard. (Big Buck Bunny 1080p 60fps)
It runs several turns with my current setup and fails to start a new one, freezes on last frame of the video.
I have used SurfaceView, TextureView and SimpleExoPlayerView, result is same for all, loop breaks after some time.
I am not seeing any log cat logs from ExoPlayer, also onPlayerError is not called as well.

Note: After freeze on SimpleExoPlayerView, seeking a few seconds before the last frame results in passing to next turn successfully.

Edit: I am seeing those lines on Logcat whenever loop breaks:

09-05 16:42:46.285 216-338/? I/AudioFlinger: BUFFER TIMEOUT: remove(4096) from active list on thread 0xb372f008
09-05 16:42:48.742 216-338/? D/AudioHardwareTiny: close device

Reproduction steps

This is how I prepare player and run the loop:

private fun prepareExoPlayerFromFileUri(uri: Uri, mediaView: SurfaceView) {
    val exoPlayer = ExoPlayerFactory.newSimpleInstance(DefaultRenderersFactory(this), DefaultTrackSelector(null as BandwidthMeter?), DefaultLoadControl())
    exoPlayer.setVideoSurfaceView(mediaView)

    val dataSpec = DataSpec(uri)
    val fileDataSource = FileDataSource()
    try {
        fileDataSource.open(dataSpec)
    } catch (e: FileDataSource.FileDataSourceException) {
        e.printStackTrace()
    }

    val factory = DataSource.Factory { fileDataSource }
    val mediaSource = ExtractorMediaSource(fileDataSource.uri, factory, DefaultExtractorsFactory(), null, null)

    exoPlayer.prepare(mediaSource)
    exoPlayer.repeatMode = Player.REPEAT_MODE_ONE
    exoPlayer.playWhenReady = true
}

Link to test content

Videos can be found here:
http://bbb3d.renderfarming.net/download.html
It is Full HD (1920x1080) under the section Standard 2D

Version of ExoPlayer being used

version 2.5.1

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

Asus Tinkerboard booted with Android Marshmallow

A full bug report captured from the device

Here is a bugreport using adb:
https://www.dropbox.com/s/rrk3hsrqmmz3pzy/exoplayer.debug.log.txt?dl=0

@tonihei tonihei self-assigned this Sep 5, 2017
@tonihei
Copy link
Collaborator

tonihei commented Sep 6, 2017

I can reproduce your problem on another device and it's also independent of the view you use.

The reason behind this is that the media file is broken because the audio track is slightly shorter than the video track. As a result the player switches to buffering in order to wait for audio that will never come. When playing this media on its own without looping, this is not a problem, because all streams just play out independently. However, for looping and concatenation the player expect both streams to end simultaneously to allow the next media file to start correctly.

The issue is actually known and already tracked in #1874. There is some work in progress to prevent this from happening (e.g. by introducing some silence while the video plays out the remaining frames).

@tonihei tonihei closed this as completed Sep 6, 2017
@google google locked and limited conversation to collaborators Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants