Weird problem with Bluetooth audio streaming (Pause and Stop)

Hi there

I installed or activated Bluetooth Audio streaming on my Raspberry Pi 3 as explained here. Well, it kinda works ok if I use an external Bluetooth Dongle, the internal BT is just not working and stops streaming after a random number of seconds. The external BT dongle works fine. However - I experienced the following strange and annoying behauviour:

If Audio Output is set to “HDMI” or “HDMI and Analogue” everything works fine and Audio is connected to my audio receiver (Onkyo). I can play, pause and stop as you would expect. All normal.

If Audio Output is set to “Alsa:OSMC streaming to Bluetooth speaker / headphone” then audio is correctly routed to my headphones. If I pause media or Live TV (Timeshift) via Remote or headphone then after a few seconds the system stops (like pressing the STOP button) getting me back to the main menu! WTH?. I can not get a cold beer from the fridge in the other room without searching the just watched episode again and restart it. No pause function anymore. Am I the only one?

What can I do? Is there any logfile or something I can give to you to fix this mega-annoying bug? Or do you need any more information?

By the way, I am using TVHeadend 4.0.9 from the app store on the same Raspberry. Beside TVHeadend there is nothing else working in the background.

Thanks for reading

Norm

More information I found in the kodi.log:

00:03:18.090 T:1958679472 NOTICE: VideoPlayer: Opening: nfs://10.42.0.2/volume2/Serien/Humans/Season 1/s01e01.mkv 00:03:18.090 T:1958679472 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED 00:03:18.091 T:1186980848 NOTICE: Creating InputStream 00:03:18.104 T:1186980848 NOTICE: Creating Demuxer 00:03:18.369 T:1186980848 NOTICE: Opening stream: 0 source: 256 00:03:18.369 T:1186980848 NOTICE: Creating video codec with codec id: 28 00:03:18.380 T:1186980848 NOTICE: Creating video thread 00:03:18.380 T:1666184176 NOTICE: running thread: video_thread 00:03:18.380 T:1186980848 NOTICE: Opening stream: 1 source: 256 00:03:18.380 T:1186980848 NOTICE: Finding audio codec for: 86019 00:03:18.381 T:1186980848 NOTICE: Creating audio thread 00:03:18.381 T:1302328304 NOTICE: running thread: CVideoPlayerAudio::Process() 00:03:18.394 T:1302328304 NOTICE: Creating audio stream (codec id: 86019, channels: 2, sample rate: 48000, no pass-through) 00:03:18.978 T:1666184176 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer 00:09:00.003 T:1596978160 ERROR: PVR - UpdateEpgEvent - epg update failed for event change (486817) 00:12:00.012 T:1596978160 ERROR: PVR - UpdateEpgEvent - epg update failed for event change (535331) 00:20:00.014 T:1596978160 ERROR: PVR - UpdateEpgEvent - epg update failed for event change (537343) 00:24:27.289 T:1666184176 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer 00:24:28.175 T:1771516912 WARNING: Previous line repeats 2 times. 00:24:28.175 T:1771516912 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.AttributeError'> Error Contents: 'NoneType' object has no attribute 'Pause' Traceback (most recent call last): File "/usr/share/kodi/addons/service.osmc.btplayer/service.py", line 200, in onPlayBackPaused self.btPlayer.pause() File "/usr/share/kodi/addons/service.osmc.btplayer/service.py", line 169, in pause self.player.Pause(dbus_interface=PLAYER_IFACE) AttributeError: 'NoneType' object has no attribute 'Pause' -->End of Python script error report<-- 00:24:43.987 T:1958679472 NOTICE: CVideoPlayer::CloseFile() 00:24:43.987 T:1958679472 NOTICE: VideoPlayer: waiting for threads to exit 00:24:43.996 T:1186980848 NOTICE: CVideoPlayer::OnExit() 00:24:43.996 T:1186980848 NOTICE: Closing stream player 1 00:24:43.996 T:1186980848 NOTICE: Waiting for audio thread to exit 00:24:43.996 T:1302328304 ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true 00:24:43.997 T:1302328304 NOTICE: thread end: CVideoPlayerAudio::OnExit() 00:24:43.997 T:1186980848 NOTICE: Closing audio device 00:24:44.041 T:1186980848 NOTICE: Deleting audio codec 00:24:44.134 T:1186980848 NOTICE: Closing stream player 2 00:24:44.134 T:1186980848 NOTICE: waiting for video thread to exit 00:24:44.134 T:1666184176 ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true 00:24:44.134 T:1666184176 NOTICE: thread end: video_thread

Maybe this is helpful.

We need a full debug log, not snippets. This also isn’t a debug log.

TVHeadend doesn’t support timeshift. If you try and timeshift the playback will stop once the buffer is exhausted. This isn’t a bug, it’s a limitation of TVHeadend.

Would you then be so kind to tell me how to get a debug log?

And btw, the error message is right in the snipet. That’s the moment when the player goes into STOP mode.

And yes, TVHeadend supports Timeshift without any problems - I used it many times. And the problem with pause and stop has nothing to do with TVHeadend - I am talking about a local video file as you also can see in the log snipet (first line in the log I provided).

It seems to be a problem in the BTplayer but I am no programmer, so what do I know.

It doesn’t.

At least not properly. Both TVHeadend and Kodi forums will confirm this.

Your log snippet isn’t sufficient. Please read the Wiki on how to provide full logs.

Sam

I did upload full logs via My OSMC log uploader. Is that enough or do you need any additional information?

You need to provide URL to your logs, as it is said in the Wiki.

I am confused now. I did exactly what the Wiki said. I enabled Debug Logging, re-produced the bug and went to My OSMC → Log Uploader and uploaded a full set of logs. There was no URL involved. So what are you talking about? Do I have to provide a URL? And where should I enter it? And what URL?

I only have “Upload Selected Logs Now” - and I can either hit OK or go back.

This is what the Wiki says:

Providing diagnostic logs

Logs are needed so we can identify problems quickly. A full set of logs should be uploaded with ease via My OSMC.

Before uploading any logs, you should ensure that Debugging is enabled in Kodi…

I did exactly that.

Ok, I now did what is described if I cannot use My OSMC and did the grab thingy:

Logs available at http://paste.osmc.io/uzomufemef

Is this ok and why did I not get that in the Log Uploader via My OSMC?

Once you select OK, you must wait for the notification to appear on screen that contains the URL. Could take up to 30secs, depending on log size and which device you are using. Alternatively, grab-logs -A in an SSH session will also upload logs and return the URL in command line.

Thanks for the info - I waited for five minutes after pressing OK. Nothing happened. No notification whatsoever.

Anyway, you will find the Pause - Stop bug at 11:01:29.301 T:1770173424 in the logs.

I think this issue is the same as Kodi v17 Playback crash on "Pause" - #6 by gezb

As detailed in the other thread we have a fix for this which should be released shortly

For now if you are not streaming to OSMC via bluetooth you could disable the BTPlayer add-on go to Settings → Add-on Browser → My Add-ons → Services. Select BTPlayer and disable it (you may need to restart for this to take affect)

This will stop the service that is listening for A2DP streaming but also has some hooks listening for play/pause events that are causing your issue - they are firing when they are not meant to as they are not currently checking if the BTPlayer is active in kodi

Thanks for the heads up. And no, if I am not streaming via Bluetooth but HDMI then there is no problem at all - all works fine.

Looking forward to the update to fix this annoying bug. Thank you.