-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix DASH VOD and Live manifest and segment pacing #21
base: master
Are you sure you want to change the base?
Conversation
any interest? |
Hello, thanks for your contribution, we are going to review and test the PR as soon as possible. Regards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
I left you some comments, mostly regarding code style to follow the conventions of the project.
Thanks for your contribution.
Regards
@@ -67,7 +67,9 @@ public MediaRepresentation findMatchingVariant(List<MediaRepresentation> variant | |||
boolean initialLoop = true; | |||
while (!mediaPlayback.hasEnded()) { | |||
if (mediaPlayback.needsManifestUpdate() && !initialLoop) { | |||
long awaitMillis = manifest.getReloadTimeMillis(timeMachine.now()); | |||
long segmentDurationMillis = (long) mediaPlayback.getLastSegment().getDurationSeconds() * 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is too long, does not fit with code style
long segmentDurationMillis = (long) mediaPlayback.getLastSegment().getDurationSeconds() * 1000; | |
long segmentDurationMillis = | |
(long) mediaPlayback.getLastSegment().getDurationSeconds() * 1000; |
@@ -219,11 +221,9 @@ private boolean hasContents() { | |||
return segmentBuilder != null; | |||
} | |||
|
|||
// dynamic manifests (live) or empty segment list require manifest get (timing determined elsewhere) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again this line is too long
// dynamic manifests (live) or empty segment list require manifest get (timing determined elsewhere) | |
// dynamic manifests (live) or empty segment list require manifest get (timing determined | |
// elsewhere) |
@@ -6,6 +6,9 @@ | |||
import io.lindstrom.mpd.data.MPD; | |||
import io.lindstrom.mpd.data.Period; | |||
import io.lindstrom.mpd.data.PresentationType; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the project code style, the imports should be in alphabetical order
private final List<MediaPeriod> periods; | ||
private Instant playbackStartTime; | ||
private static final Logger LOG = LoggerFactory.getLogger(Manifest.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static variables should be defined at the beginning of variables definition
@@ -97,7 +106,12 @@ public Duration getBufferStartTime() { | |||
|
|||
public Instant getAvailabilityStartTime() { | |||
OffsetDateTime time = mpd.getAvailabilityStartTime(); | |||
return time != null ? time.toInstant() : Instant.MIN; | |||
// simulating availabilityStartTime for VOD enables pacing of segment GETs according to segment duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long
// simulating availabilityStartTime for VOD enables pacing of segment GETs according to segment duration | |
// simulating availabilityStartTime for VOD enables pacing of segment GETs according to | |
// segment duration |
@@ -12,7 +12,7 @@ | |||
VideoStreamingHttpClient httpClient, | |||
TimeMachine timeMachine, SampleResultProcessor sampleResultProcessor) { | |||
//HLS Master Playlist must contain this .m3u8 extension in their URLs | |||
if (url.contains(".m3u8")) { | |||
if (url.contains(".m3u8")||url.contains("format=m3u8")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between OR
if (url.contains(".m3u8")||url.contains("format=m3u8")) { | |
if (url.contains(".m3u8") || url.contains("format=m3u8")) { |
public long getReloadTimeMillis(long segmentDurationMillis) { | ||
Duration minUpdatePeriod = mpd.getMinimumUpdatePeriod(); | ||
// wait at least segment duration if minUpdatePeriod is 0 (or very small) | ||
long maxIntervalTime = Math.max(minUpdatePeriod.toMillis(), segmentDurationMillis); | ||
Instant now = Instant.now(); | ||
|
||
return Math.max(maxIntervalTime - Duration.between(lastDownLoadTime, now).toMillis(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both minUpdatePeriod
& now
could be inlined, due to them are only used once.
public long getReloadTimeMillis(long segmentDurationMillis) { | |
Duration minUpdatePeriod = mpd.getMinimumUpdatePeriod(); | |
// wait at least segment duration if minUpdatePeriod is 0 (or very small) | |
long maxIntervalTime = Math.max(minUpdatePeriod.toMillis(), segmentDurationMillis); | |
Instant now = Instant.now(); | |
return Math.max(maxIntervalTime - Duration.between(lastDownLoadTime, now).toMillis(), 0); | |
public long getReloadTimeMillis(long segmentDurationMillis) { | |
// wait at least segment duration if minUpdatePeriod is 0 (or very small) | |
long maxIntervalTime = Math.max(mpd.getMinimumUpdatePeriod().toMillis(), segmentDurationMillis); | |
return Math | |
.max(maxIntervalTime - Duration.between(lastDownLoadTime, Instant.now()).toMillis(), 0); | |
} |
Any updates on this PR? @gmarzot |
oh boy - I am very sorry to have let this slide.. my patches did more or
less what i wanted locally and even though all the requests made sense
never got to it.
I do continue to see cases where the pacing gets really extreme .. looking
like a request storms. Hopefully i'll find time to get back to it in the
new year
…On Mon, Dec 6, 2021 at 12:32 PM Ricardo Poleo ***@***.***> wrote:
Any updates on this PR? @gmarzot <https://github.com/gmarzot>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7T3ID7PNHJM4Z272VPLGLUPTXRXANCNFSM4W2YFPEQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
This works for DASH Live and VOD. Manifest GET rate for Live will not exceed media segment duration. For DASH VOD segment GET rate is determined by segment duration.
I have not looked at HLS yet.