-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
New command line argument: hls_media_sequence_number #702
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
@googlebot I fixed it. |
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.
Thanks for the pull request. Generally looks good with a few misc comments and more questions.
packager/hls/base/media_playlist.cc
Outdated
@@ -390,6 +390,11 @@ bool MediaPlaylist::SetMediaInfo(const MediaInfo& media_info) { | |||
characteristics_ = | |||
std::vector<std::string>(media_info_.hls_characteristics().begin(), | |||
media_info_.hls_characteristics().end()); | |||
|
|||
if (hls_params_.media_sequence_number > media_sequence_number_) { |
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.
You can move it to MediaPlaylist constructor (line 346):
: hls_params_(hls_params),
file_name_(file_name),
name_(name),
group_id_(group_id),
media_sequence_number_(hls_params_.media_sequence_number) {}
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.
Done and tested. Works fine by my side.
packager/hls/base/media_playlist.cc
Outdated
hls_params_.media_sequence_number == media_sequence_number_) { | ||
// When there's a forced media_sequence_number, start with discontinuity. | ||
entries_.emplace_back(new DiscontinuityEntry()); | ||
inserted_discontinuity_tag_ = true; |
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 can be removed. It is used to avoid inserting multiple discontinuity tag when there are multiple EXT-X-KEY tags.
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.
I'm confused about this one. You mean the inserted_discontinuity_tag_ = true;
?
I guess it was just a copypaste from the previously implemented discontinuity logic, but I kinda remember getting multiple discontinuity tags at some point. Are you sure about this?
No problem anyways, I'll do some tests to check this out.
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.
Tested. It's ok to remove it.
packager/app/hls_flags.cc
Outdated
@@ -24,3 +24,6 @@ DEFINE_string(hls_playlist_type, | |||
"VOD, EVENT, or LIVE. This defines the EXT-X-PLAYLIST-TYPE in " | |||
"the HLS specification. For hls_playlist_type of LIVE, " | |||
"EXT-X-PLAYLIST-TYPE tag is omitted."); | |||
DEFINE_int32(hls_media_sequence_number, | |||
0, | |||
"Number. This defines the initial EXT-X-MEDIA-SEQUENCE value"); |
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.
Can you add more background? e.g.
This defines the initial EXT-X-MEDIA-SEQUENCE value, which allows continuous media sequence across packager restarts. See #691 for more backgrounds.
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.
Can you also update docs/source/options/hls_options.rst?
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.
It is done here. Please take a look at it to check if you're ok with what I wrote (english is not my native language).
@kqyang Thank you very much for your time. I'll apply your changes as soon as I my agenda allows it. But just a quick question first. I'm a newbie in github's PRs. What's the procedure to alter the PR's code? I just modify my fork and create a new PR? |
@kqyang I've applied modifications based on all your comments. |
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.
Sorry for the delay in review. Mostly LGTM with a few more nit comments.
docs/source/options/hls_options.rst
Outdated
EXT-X-MEDIA-SEQUENCE value. This way, it's possible to continue the sequence | ||
number from previous packager run. | ||
|
||
See #691 for more information about the reasoning of this. |
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.
Can you replace #691 with `#691 <https://github.com/google/shaka-packager/issues/691>`_ as it is not automatically linked in our doc generator.
packager/hls/public/hls_params.h
Outdated
@@ -56,6 +56,8 @@ struct HlsParams { | |||
/// be populated from segment duration specified in ChunkingParams if not | |||
/// specified. | |||
double target_segment_duration = 0; | |||
/// This allows to change the initial EXT-X-MEDIA-SEQUENCE field value. |
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.
Change to something like: (Also note 80 line length limit)
/// Custom EXT-X-MEDIA-SEQUENCE value to allow continuous media playback across packager restarts. See #691 for details.
packager/hls/base/media_playlist.cc
Outdated
} else if (hls_params_.media_sequence_number > 0 && | ||
hls_params_.media_sequence_number == media_sequence_number_) { | ||
// When there's a forced media_sequence_number, start with discontinuity. | ||
entries_.emplace_back(new DiscontinuityEntry()); |
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.
It looks like we can move this block to the constructor, i.e. after line 347, which simplifies the logic a little bit:
group_id_(group_id),
media_sequence_number_(hls_params_.media_sequence_number) {
// When there's a forced media_sequence_number, start with discontinuity.
if (media_sequence_number_ > 0)
entries_.emplace_back(new DiscontinuityEntry());
}
@kqyang Done! :) |
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.
Thanks. There is still a small in the documentation.
docs/source/options/hls_options.rst
Outdated
number from previous packager run. | ||
|
||
For more information about the reasoning of this, see issue #691: | ||
`<https://github.com/google/shaka-packager/issues/691>`_ |
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.
Sorry for not making it clearer. #691 should be moved after `. See examples here: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases
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.
Oh... it just felt wrong to have a large line (even when converted later), so I changed the text. My bad. I'll fix it right away.
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.
Well... this is silly, but I guess it's better to explain myself. I'm gonna change it to this:
For more information about the reasoning of this, please see issue
`#691 <https://github.com/google/shaka-packager/issues/691>`_
But that means later will get the issue number after a newline.
OTOH, if I put it this other way:
For more information about the reasoning of this, see `#691 <https://github.com/google/shaka-packager/issues/691>`_
It will end up nice in the docs, but ugly in the code.
Given that it would be the only long line I see in the docs, I'll go with option 1.
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.
Yes, please go with option 1. New line in the code is not rendered in the docs :)
docs/source/options/hls_options.rst
Outdated
`<https://github.com/google/shaka-packager/issues/691>`_ | ||
|
||
The EXT-X-MEDIA-SEQUENCE documentation can be read here: | ||
`<https://tools.ietf.org/html/rfc8216#section-4.3.3.2>`_ |
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.
There is no need to quote it inside `` and <> as it does not have a text.
docs/source/options/hls_options.rst
Outdated
number from previous packager run. | ||
|
||
For more information about the reasoning of this, please see issue | ||
`#691 <https://github.com/google/shaka-packager/issues/691>`_ |
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.
Sorry, one more change. Can you include a period, i.e. "." in the end of both line 74 and line 77.
@Canta Thanks for working on this! Have you tested and verified the changes work as expected? I am going to merge the change once appveyor and travis complete the build. |
@kqyang Well, I did some tests, but I'm ignorant about this project's testing pipeline, so IDK if my tests are valid. What I did was building the code and testing the details we've been discussing here. That worked fine by my side. My tests were:
In fact, I have my fork working fine on a server since weeks from now, without any issue. Please tell me if you need some better validation than this. |
@Canta That is the answer I am expecting. Thanks a lot in bringing up the issue and addressing the issue. Appreciated! |
Btw, you may update https://github.com/google/shaka-packager/blob/master/CONTRIBUTORS and https://github.com/google/shaka-packager/blob/master/AUTHORS. It can be either a separate pull request or you can do it together with #701. |
Also, added Daniel Cantarín to AUTHORS and CONTRIBUTORS files, as per @kqyang comment: shaka-project#702 (comment)
See #691 for details on the use cases behind this.
Regarding the code changes:
media_sequence_number
variable was changed to unsigned, as otherwise "big" media sequence numbers would end up negative, and there's no reason for this var not being unsigned.