fix DASH VOD and Live manifest and segment pacing#21
fix DASH VOD and Live manifest and segment pacing#21gmarzot wants to merge 4 commits intoBlazemeter:masterfrom
Conversation
|
any interest? |
|
Hello, thanks for your contribution, we are going to review and test the PR as soon as possible. Regards. |
sebastianlorenzo88
left a comment
There was a problem hiding this comment.
Hello,
I left you some comments, mostly regarding code style to follow the conventions of the project.
Thanks for your contribution.
Regards
| 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.
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; |
| return segmentBuilder != null; | ||
| } | ||
|
|
||
| // dynamic manifests (live) or empty segment list require manifest get (timing determined elsewhere) |
There was a problem hiding this comment.
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) |
| 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.
according to the project code style, the imports should be in alphabetical order
| private final Instant lastDownLoadTime; | ||
| private final List<MediaPeriod> periods; | ||
| private Instant playbackStartTime; | ||
| private static final Logger LOG = LoggerFactory.getLogger(Manifest.class); |
There was a problem hiding this comment.
static variables should be defined at the beginning of variables definition
| 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.
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 |
| 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.
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.
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.