Exoplayer: Audio will be cut when connecting to a sound box by bluetooth.

Created on 30 Nov 2017  路  8Comments  路  Source: google/ExoPlayer

Issue description

I played a short audio when the mobile connected a sound box by bluetooth, but nothing was out from sound box.
However, it works well when the sound box is disconnected or using another mobile not Samsung.
And MediaPlayer works well, too.

Reproduction steps

Step 1锛欳onnect a mobile to a sound box with bluetooth(A2DP).
Step 2: Play a short audio like "Hello World", and part of the sound look likes being but a few.

Link to test content

audios sample link: https://www.dropbox.com/s/70te9alkirvhuic/one.ogg?dl=0

Version of ExoPlayer being used

r2.5.4

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

Devices with problem :
  • Samsung Galaxy S8 V7.0, the tail will be cut.
  • Samsung Galaxy S7 V7.0, short audio will be cut full.
  • Pixel V8.1, the tail will be cut.
  • MI 6 V7.1.1, the head will be cut.
Devices without problem :
  • Pixel XL V8.0
  • LGU992 V8.0
  • Nexus 6 5.1.1

A full bug report captured from the device

bug report link: https://www.dropbox.com/s/b30j1hplm52njk1/bugreport-2017-11-30-10-27-22.zip?dl=0

device specific

Most helpful comment

There were some recent fixes on the dev-v2 branch to play out all audio when transitioning between playlist items where there was an audio format change. I am going to close this issue as it's likely it was addressed by those changes. If you still see this problem when using the development branch please file a new issue.

All 8 comments

I dont think it is a device specific issue, and the pixel has the same issue.

Could you elaborate a bit about which devices are affected or not affected? You wrote "However, it works well when the sound box is disconnected or using another mobile not Samsung.".

I have update the issue detail and some device with problem and without problem.

This may be related to #3386, which may be fixed by an upcoming system update.

I found putting a sleep in the MediaCodecRenderer's drainOutputBuffer right before calling processEndOfStream fixes clipping issues. The device specific part seems to be an issue with some devices not playing out the last buffer that was written to the AudioTrack when stop is called like it should.

A slightly less kluge way of fixing the issue is not calling audioTrack.stop() in the DefaultAudioSink until playback head position has reached the end. This fixes the issue if you are playing just one short clip, but there is maybe a separate issue with the same symptoms that doesn't appear to be device specific.

The other clipping issue is happening when I use ConcatenatingMediaSource for several different sources. In this case processEndOfStream is calling releaseCodec maybe too early.

Having the same issue here when using ConcatenatingMediaSource. As mentioned by @mikal-ustad, sleeping the thread in processEndOfStream available in the MediaCodecRenderer class seems to work. This looks like a potential workaround while this issue gets fixed, but is there any other alternative for doing this that we could explore?

Running into the same issue when using ConcatenatingMediaSource. Solution suggested by @mikal-ustad doesn't seem to be an option because it requires modifying the ExoPlayer library code.

There were some recent fixes on the dev-v2 branch to play out all audio when transitioning between playlist items where there was an audio format change. I am going to close this issue as it's likely it was addressed by those changes. If you still see this problem when using the development branch please file a new issue.

Was this page helpful?
0 / 5 - 0 ratings