xbmc / xbmc

Kodi is an award-winning free and open source home theater/media center software and entertainment hub for digital media. With its beautiful interface and powerful skinning engine, it's available for Android, BSD, Linux, macOS, iOS, tvOS and Windows.
https://kodi.tv/
Other
18.34k stars 6.29k forks source link

Strange Audio "pause behavior" when pause a movie #15620

Open iz8mbw opened 5 years ago

iz8mbw commented 5 years ago

Bug report

Kodi goes to "pause" audio stream when we put in pause a movie and this causes some audio lost after resume playback.

Describe the bug

As already discuessed here https://github.com/xbmc/xbmc/pull/15601#issuecomment-467348696 when we go to put in pause a movie (a content) Kodi will go to "Pause" the audio stream and later will go to "resume" it again. On the AVR I see the codec disappear and after about 500ms appear again, and this happens when the movie is still in pause! When I play again the paused movie (resume playback) on the AVR I see the codec disappear again and after about 500ms appear again (so video starts before the audio) and so we will lost some audio moments because video starts a little bit before caused by this "strange pause audio behavior".... This happens when "Keep audio device alive" is enabled (since "Keep audio device alive" is enabled I expect that Kodi will NOT to go to do nothing).

Instead if we go to disable "Keep audio device alive" it's worse because the behavior is the same but it's more "slow" because when Kodi will go to "pause" the audio stream, the codec on my AVR will change from the movies' codec (example Dolby Digital) to PCM and when I resume playback changes again from PCM to the movies' codec (example Dolby Digital). Also in this case we will lost some audio moments because video starts a little bit before.

Expected Behavior

What I expect is: if I put in pause a movie then NO new "audio stream pause/interruption/signal" should be sent.

Actual Behavior

Described in the "Describe the bug" section

To Reproduce

Steps to reproduce the behavior:

  1. Put in play (in audio passthrough) a movie
  2. Put in pause
  3. Resume playback

Debuglog

The debuglog can be found here: https://paste.kodi.tv/bujagucizi.kodi

Additional context or screenshots (if appropriate)

From the log: I put in pause the movie:

2019-02-25 20:36:25.372 T:13008   DEBUG: HandleKey: return (0xf00d) pressed, action is Select
2019-02-25 20:36:25.373 T:13013   DEBUG: CAnnouncementManager - Announcement: OnPause from xbmc
2019-02-25 20:36:25.373 T:13013   DEBUG: void CXBMCApp::OnPlayBackPaused()

and the Audio "behavior":

2019-02-25 20:36:25.392 T:13209   DEBUG: CDVDAudio::Pause - pausing audio stream
2019-02-25 20:36:25.392 T:13208   DEBUG: CDVDVideoCodecAndroidMediaCodec::AddData dts:2825823000.00 pts:2825990000.00 sz:106715 indexBuffer:-1 current state (3)
2019-02-25 20:36:25.421 T:13008   DEBUG: Previous line repeats 23 times.
2019-02-25 20:36:25.421 T:13008   DEBUG: CMediaCodecVideoBuffer::ReleaseOutputBuffer index(5), render(1), time:86028219578118, offset:52920259
2019-02-25 20:36:25.422 T:13208   DEBUG: CDVDVideoCodecAndroidMediaCodec::AddData dts:2825823000.00 pts:2825990000.00 sz:106715 indexBuffer:-1 current state (3)
2019-02-25 20:36:25.581 T:13008   DEBUG: Previous line repeats 133 times.
2019-02-25 20:36:25.582 T:13008   DEBUG: Uninhibiting OS screen saver
2019-02-25 20:36:25.583 T:13208   DEBUG: CDVDVideoCodecAndroidMediaCodec::AddData dts:2825823000.00 pts:2825990000.00 sz:106715 indexBuffer:-1 current state (3)
2019-02-25 20:36:29.626 T:13008   DEBUG: Previous line repeats 3375 times.

Then I resume payback:

2019-02-25 20:36:29.709 T:13013   DEBUG: CAnnouncementManager - Announcement: OnResume from xbmc
2019-02-25 20:36:29.709 T:13013   DEBUG: void CXBMCApp::OnPlayBackStarted()
2019-02-25 20:36:29.710 T:13208   DEBUG: CDVDVideoCodecAndroidMediaCodec::AddData dts:2825823000.00 pts:2825990000.00 sz:106715 indexBuffer:-1 current state (3)
2019-02-25 20:36:29.715 T:13013   DEBUG: Visible Behind request: false
2019-02-25 20:36:29.716 T:13013   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnResume
2019-02-25 20:36:29.716 T:13019   DEBUG: ActiveAE - start sync of audio stream
2019-02-25 20:36:29.716 T:13208   DEBUG: CDVDVideoCodecAndroidMediaCodec::AddData dts:2825823000.00 pts:2825990000.00 sz:106715 indexBuffer:-1 current state (3)
2019-02-25 20:36:29.717 T:13209   DEBUG: CDVDAudio::Resume - resume audio stream
2019-02-25 20:36:29.718 T:13013   DEBUG: UPnP: Building didl for object 'smb://NAS/Multimedia/Film/HD/Cartoon/Movie_with_DTS_track.mkv'

Your Environment

Used Operating system:

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required. Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

iz8mbw commented 5 years ago

@peak3d @fritsch as suggested, new Issue created. Thank you!

bronnel commented 5 years ago

I think this issue is similar to mine correct me if I'm wrong , when I pause the a movie and then resume playback a couple of seconds of the audio is lost , this problem has been there since krypton and continues with latest version of leia

iz8mbw commented 5 years ago

Yes. This problem is the same.

rafakob commented 2 years ago

Any luck with that? :(

github-actions[bot] commented 2 months ago

This issue is now marked stale because it has been open over a year without activity. Remove the stale label or add a comment to reset the stale state.