-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Expose peakBitrate
property in Format
#6706
Conversation
Fixes google#2863 Exposes `peakBitrate` value when both `BANDWIDTH` and `AVERAGE-BANDWIDTH` attributes are available. The `bitrate` property will always carry the average bandwidth of the `Format` instance, while `peakBitrate` will carry the value for the respective attribute, when present; according to tools.ietf.org/html/draft-pantos-http-live-streaming-23#page-28
assertThat(variants.get(1).format.bitrate).isEqualTo(1270000); | ||
assertThat(variants.get(1).format.peakBitrate).isEqualTo(1280000); |
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 is the example case for the presence of the attribute.
@@ -236,14 +236,17 @@ public void testParseMasterPlaylist() throws IOException { | |||
} | |||
|
|||
@Test | |||
public void testMasterPlaylistWithBandwdithAverage() throws IOException { | |||
public void testMasterPlaylistWithBandwidthAverage() throws IOException { |
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.
Fixed typo.
When running locally, some |
Mind taking a look Santiago? |
I think this is for @ojw28 to look at. |
On my side, I think it's unfortunate we are using the Aside, I think it would be helpful for us to know why/how having both average and peak bitrates could be of use. |
@AquilesCanta Please check the referred issue #2863 for context. |
My bad, didn't see the link. However, the referenced issue makes the same question I made above. And an answer is still not available. It's worth looking into the issue first. EDIT: @ojw28 removed the need more info tag from the issue, so I'm assuming he understands the use case. Thanks for your patience! |
I think the peak bitrate is preferable for adaptive track selection to be on the safe side, especially when the peak is much higher than the average. Otherwise, the ABR algorithm may run into issues during complex scenes. So, if available, we should probably just populate the |
@tonihei That is for sure. The Let me know if hiding one of the values is by design. If that's the case, we should document it publicly somewhere, I assume others might hit the same limitation in the future. |
To provide some context: Back when AVERAGE-BANDWIDTH was added to the HLS spec, preferring AVERAGE-BANDWIDTH (which is option) over BANDWIDTH (which is mandatory) was a design decision. @tonihei, please feel free to take whichever approach you think is most suitable for ABR. |
Presumably using both is preferable, else there wouldn't be value in them both existing. I agree that if we were to use just one, then peak bitrate is preferable, and so 53b52e7 was probably a mistake. I think we should expose both in |
For what it's worth, the DASH specification gives a more nuanced definition of bitrate, that seems much more useful than either "peak" or "average". I guess it's closer to "peak" in practice:
Meanwhile the HLS authoring specification seems to allow you to specify average and peak bitrates that are wrong by up to 10%, whilst referencing another section that doesn't exist. Why?
|
This is a minor change ahead of merging a full variant of #6706, to make re-buffers less likely. Also remove variable substitution when parsing AVERAGE-BANDWIDTH (it's not required for integer attributes) PiperOrigin-RevId: 283554106
This is a minor change ahead of merging a full variant of #6706, to make re-buffers less likely. Also remove variable substitution when parsing AVERAGE-BANDWIDTH (it's not required for integer attributes) PiperOrigin-RevId: 283554106
@ojw28 @marcbaechinger It seems like we have opted for exposing the peak bitrate when available, super-seeding the avg bitrate data, which hinders more advanced ABR algorithms. Let me know what you think. |
Please leave it open. We'll resolve the conflict when we merge. Thanks! |
We need to make some bigger changes to land this, which we're working on now. These changes will land separately of this pull request, so I'll go ahead and close it. Please follow the tracking bug for updates. Thanks! |
Fixes #2863
Exposes
peakBitrate
value when bothBANDWIDTH
andAVERAGE-BANDWIDTH
attributes are available.The
bitrate
property will always carry the average bandwidth of theFormat
instance, whilepeakBitrate
will carry the value for the respective attribute, when present; according to
tools.ietf.org/html/draft-pantos-http-live-streaming-23#page-28