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

Short audio files loop #2252

Closed
WeaveStudios opened this issue Dec 22, 2016 · 5 comments
Closed

Short audio files loop #2252

WeaveStudios opened this issue Dec 22, 2016 · 5 comments
Assignees
Labels

Comments

@WeaveStudios
Copy link

Hi, I upgraded to ExoPlayer r2.1.1 and I found a bug not present in r.2.04. When I play the file, everything work as expected however, if you loop it 2 or more times, some files do not play all requested counts or they just play a section of the last part and the log cat shows this:

Internal runtime error.
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.decoder.DecoderInputBuffer.setFlags(int)' on a null object reference
   at com.google.android.exoplayer2.extractor.DefaultTrackOutput.readData(DefaultTrackOutput.java:261)
   at com.google.android.exoplayer2.source.ExtractorMediaPeriod.readData(ExtractorMediaPeriod.java:328)
   at com.google.android.exoplayer2.source.ExtractorMediaPeriod$SampleStreamImpl.readData(ExtractorMediaPeriod.java:551)
   at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:263)
   at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readFormat(MediaCodecRenderer.java:494)
   at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:479)
   at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479)
   at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315)
   at android.os.Handler.dispatchMessage(Handler.java:98)
   at android.os.Looper.loop(Looper.java:148)
   at android.os.HandlerThread.run(HandlerThread.java:61)
   at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)

When the file plays normally, there is no error in logcat.

The example file will be mailed to you.

@andrewlewis
Copy link
Collaborator

Thanks for reporting this. I have an idea what might be going wrong but haven't been able to reproduce it yet -- please could you provide steps to reproduce the issue, ideally in the demo app? (e.g. modify PlayerActivity.java to pass the player a LoopingMediaSource which wraps an ExtractorMediaSource playing the local OGG file.)

@andrewlewis andrewlewis self-assigned this Dec 23, 2016
@WeaveStudios
Copy link
Author

Andrew, I mistakenly emailed a wrong file. Sorry for that. I have just sent another email with the correct one.

I was able to reproduce the issue in the demo app as instructed. I tested it in 4.2.2 and 6.0.1 devices, both Samsung.

@andrewlewis
Copy link
Collaborator

I still wasn't able to reproduce this on a Nexus 6P, preparing the demo app player with a LoopingMediaSource wrapping the WAV file you emailed. Please could you provide specific steps to reproduce in the demo app?

@WeaveStudios
Copy link
Author

I replaced line 327 of PlayerActivity.java with:

MediaSource        mAudioSource;
LoopingMediaSource mLoopingSource;

mAudioSource = new ExtractorMediaSource(Uri.parse("asset:///casio.wav"), new DefaultDataSourceFactory(getApplicationContext(), BuildConfig.APPLICATION_ID), new DefaultExtractorsFactory(), null, null);
mLoopingSource = new LoopingMediaSource(mAudioSource, 4);

player.prepare(mLoopingSource, !isTimelineStatic, !isTimelineStatic);

Compiled with build tools 25.0.2.

@andrewlewis
Copy link
Collaborator

Got it -- it is important to loop a small number of times. Thanks.

ojw28 pushed a commit that referenced this issue Jan 4, 2017
Issue: #2252

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143433510
@ojw28 ojw28 closed this as completed Jan 4, 2017
ojw28 pushed a commit that referenced this issue Jan 9, 2017
Also move timeline, manifest and format verifications into the test* methods.

Issue: #2252

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143761969
@google google locked and limited conversation to collaborators Jun 28, 2017
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

3 participants