Kodi v17 Playback crash on "Pause"

it’s better to have a fix rather for crash than for disabling :smiley:
can you say how to enable/disable it from command line?
thx

Hi @sam_nazarko
finally I find a time to have a look inside of service.py of btplayer.
So the issue in line 145:

elif iface == "MediaTransport1":
        if "State" in changed:
            if not changed["State"] == self.state:
                self.state = changed["State"]
                if not self.state  == "active":
                    xbmc.stopBTPlayer()

When I started video first time the condition

if not self.state  == "active"

returned false

Then I pressed pause, after 1-2 mins it run stopBTPlayer where same condition gave true and kodi crashed on xbmc.stopBTPlayer()

I extended the code with log messages

    elif iface == "MediaTransport1":
        if "State" in changed:
            log("Enter 1")
            if not changed["State"] == self.state:
                log("Enter 2")
                self.state = changed["State"]
                if not self.state  == "active" and xbmc.isBTPlayerActive():
                    log("Enter 3")
                    xbmc.stopBTPlayer()
                    log("Enter 4")

and got following:

15:14:49.695 T:1523577840   DEBUG: BTPlayer: Enter 1
15:14:49.695 T:1523577840   DEBUG: BTPlayer: Enter 2
15:14:49.695 T:1523577840   DEBUG: BTPlayer: Enter 3
15:14:49.706 T:1958653952   DEBUG: CGUIWindowManager::PreviousWindow: Deactivate
15:14:49.706 T:1958653952   DEBUG: ------ Window Deinit (VideoFullScreen.xml) ------
15:14:49.727 T:1958653952   DEBUG: CGUIWindowManager::PreviousWindow: Activate new
15:14:49.727 T:1958653952   DEBUG: ------ Window Init (Home.xml) ------
15:14:49.780 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/video/]: refreshing..
15:14:49.781 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/audio/]: refreshing..
15:14:49.781 T:1913648112   DEBUG: Thread JobWorker start, auto delete: true
15:14:49.781 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/executable/]: refreshing..
15:14:49.781 T:1958653952   DEBUG: CDirectoryProvider[addons://sources/image/]: refreshing..
15:14:49.789 T:1642066928   DEBUG: Thread JobWorker start, auto delete: true
15:14:52.478 T:1958653952  NOTICE: CVideoPlayer::CloseFile()
15:14:52.478 T:1958653952  NOTICE: VideoPlayer: waiting for threads to exit
15:14:52.478 T:1419740144  NOTICE: CVideoPlayer::OnExit()
15:14:52.478 T:1419740144  NOTICE: Closing stream player 1
15:14:52.478 T:1419740144  NOTICE: Waiting for audio thread to exit
15:14:52.479 T:1316668400   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true
15:14:52.479 T:1316668400  NOTICE: thread end: CVideoPlayerAudio::OnExit()
15:14:52.479 T:1316668400   DEBUG: Thread VideoPlayerAudio 1316668400 terminating
15:14:52.479 T:1419740144  NOTICE: Closing audio device
15:14:52.479 T:1419740144   DEBUG: CDVDAudio::Flush - flush audio stream
15:14:52.480 T:1934033904   DEBUG: CActiveAE::DiscardStream - audio stream deleted
15:14:52.480 T:1934033904   DEBUG: CActiveAE::ClearDiscardedBuffers - buffer pool deleted
15:14:52.483 T:1419740144   DEBUG: Previous line repeats 3 times.
15:14:52.483 T:1419740144  NOTICE: Deleting audio codec
15:14:52.483 T:1419740144  NOTICE: Closing stream player 2
15:14:52.484 T:1419740144  NOTICE: waiting for video thread to exit
15:14:52.484 T:1325057008   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true
15:14:52.484 T:1325057008  NOTICE: thread end: video_thread
15:14:52.484 T:1325057008   DEBUG: Thread VideoPlayerVideo 1325057008 terminating
15:14:52.486 T:1419740144  NOTICE: deleting video codec
15:14:52.493 T:1411351536   DEBUG: Thread FileCache 1411351536 terminating
15:14:52.504 T:1419740144   DEBUG: OnPlayBackStopped: play state was 2, starting 0
15:14:52.508 T:1419740144   DEBUG: Thread VideoPlayer 1419740144 terminating
15:14:52.508 T:1958653952  NOTICE: VideoPlayer: finished waiting
15:14:52.508 T:1958653952   DEBUG: DeleteRenderer - deleting renderer
15:14:52.508 T:1958653952   DEBUG: CMMALRenderer::~CMMALRenderer
15:14:52.508 T:1958653952   DEBUG: CMMALRenderer::UnInitMMAL
15:14:52.533 T:1958646768   DEBUG: CAnnouncementManager - Announcement: OnStop from xbmc
15:14:52.533 T:1958646768   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnStop
15:14:52.539 T:1299891184   DEBUG: CMMALRenderer::Process - stopping
15:14:52.539 T:1299891184   DEBUG: Thread MMALRenderer 1299891184 terminating
15:14:52.558 T:1958653952   DEBUG: CMMALPool::~CMMALPool Destroying pool 0x5b468f00 for port vc.ril.video_decode:out:0(OPQV)
15:14:52.562 T:1308279792   DEBUG: CMMALRenderer::Run - stopping
15:14:52.562 T:1308279792   DEBUG: Thread MMALProcess 1308279792 terminating
15:14:52.563 T:1523577840   DEBUG: BTPlayer: Enter 4 xbmc.stopBTPlayer()

kodi crash happened exactly on

15:14:52.484 T:1325057008   ERROR: Got MSGQ_ABORT or MSGO_IS_ERROR return true

I also tried to extend else condition to xbmc.isBTPlayerActive() and had no more crash

elif iface == "MediaTransport1":
        if "State" in changed:
            if not changed["State"] == self.state:
                self.state = changed["State"]
                if not self.state  == "active" and xbmc.isBTPlayerActive():
                    xbmc.stopBTPlayer()

Unfortunately my knowledge of xbmc and dbus is close to zero, so if you have any ideas please help

Thanks!
cc @gezb @matejmosko

Looks good – let me know if this continues to work.

Sam

Hi @sam_nazarko
I’ve made pull request with extended “idle” status in addition to “active”:

For me now it works perfectly, but I’m using osmc with streaming in direction OSMC => a2dp => bluetooth speaker.
It would be nice if you can test it also for scenario “bluetooth audio => osmc” and switching between OSMC => bluetooth and bluetooth => OSMC
Thanks.
cc @gezb @matejmosko