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

DASH - Clip playback at period end times (i.e. once period duration is reached) #4185

Closed
kevleyski opened this issue Apr 26, 2018 · 5 comments
Assignees
Labels

Comments

@kevleyski
Copy link

Issue description

A static MPD with multiple Periods can play out differently between Shaka (e.g. PC/Chromecast) vs Android and AndroidTV devices.

Looking further it seems that the logic in library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java::updatePeriods() is the reason for this because Periods will not advance to the next Period when there might still be some audio/video data remaining to be rendered.

Example work-around...

// If end of Period is reached then allow advancing to next Period
boolean isAtEndOfPeriod = (rendererPositionUs >= playingPeriodHolder.next.rendererPositionOffsetUs);

for (int i = 0; i < renderers.length; i++) {
  Renderer renderer = renderers[i];
  SampleStream sampleStream = readingPeriodHolder.sampleStreams[i];
  if (renderer.getStream() != sampleStream
      || (sampleStream != null && !renderer.hasReadStreamToEnd() && !isAtEndOfPeriod)) {
    // The current reading period is still being read by at least one renderer.
    return;
  }
}

Reproduction steps

Posted privately is an example MPD that has correct Periods
However the segments between the audio and video adaptation do not quite align, that is they do not all finish exactly at the point of the end of the Period
The second Period then does not play out until all renderers have finished.
In contrast, Shaka (v2.3.0) and DASH.IF (v2.6.8) advance correctly based on Period duration/start of next period.

Link to test content

(private post)

Version of ExoPlayer being used

2.7.3 (release-v2 branch)

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

Google Pixel 2 'phone: Oreo
Emulator: Android P

A full bug report captured from the device

(private post)

kevleyski pushed a commit to kevleyski/ExoPlayer that referenced this issue Apr 26, 2018
…ods do not advance whilst media renderer has more data

A static MPD with multiple Periods can play out differently between Shaka (e.g. PC/Chromecast) vs Android and AndroidTV devices.

Looking further it seems that the logic in library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java::updatePeriods() is the reason for this because Periods will not advance to the next Period when there might still be some audio/video data remaining to be rendered.
kevleyski pushed a commit to kevleyski/ExoPlayer that referenced this issue Apr 26, 2018
…iods do not advance whilst media renderer has more data

A static MPD with multiple Periods can play out differently between Shaka (e.g. PC/Chromecast) vs Android and AndroidTV devices.

Looking further it seems that the logic in updatePeriods() is the reason for this because Periods will not advance to the next Period when there might still be some audio/video data remaining to be rendered.
@ojw28 ojw28 changed the title Shaka vs ExoPlayer behaviour difference. Multi-Periods do not advance whilst media renderer has more data DASH - Clip playback at period end times (i.e. once period duration is reached) Apr 26, 2018
@ojw28 ojw28 added the bug label Apr 26, 2018
@ojw28
Copy link
Contributor

ojw28 commented Apr 26, 2018

I think this needs fixing somewhere in the DASH module, rather than in ExoPlayerImplInternal as in the pull request. In particular this is because:

  • I don't think we want this kind of clipping for other media types (e.g. a playlist of mp3 files, where durations may be inaccurate but we really don't want to start clipping before moving on to the next one).
  • From DASH IF discussions, my understanding is that period duration is allowed to be much shorter the underlying media. In this case the player shouldn't buffer media beyond the period duration, because it's inefficient to do so. A fix in the DASH module would be necessary to avoid this.

@ojw28 ojw28 self-assigned this Apr 26, 2018
@kevleyski
Copy link
Author

Let me know if I can help further, happy to try/test

@kevleyski
Copy link
Author

Any further thoughts on this/things I might try out?

@ojw28
Copy link
Contributor

ojw28 commented May 7, 2018

You could have a stab at fixing it in the DASH module, if you feel sufficiently motivated! As above, any solution should also avoid request segments that will not be played due to clipping as a result of the specified period duration.

kevleyski pushed a commit to kevleyski/ExoPlayer that referenced this issue Jul 5, 2018
ojw28 added a commit that referenced this issue Sep 12, 2018
Issue: #4185

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212619419
@ojw28 ojw28 closed this as completed Sep 12, 2018
@kevleyski
Copy link
Author

kevleyski commented Sep 12, 2018 via email

@google google locked and limited conversation to collaborators Jan 31, 2019
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

2 participants