-
Notifications
You must be signed in to change notification settings - Fork 409
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
SntpClient periodically re-syncs the offset to NTP server #1794
SntpClient periodically re-syncs the offset to NTP server #1794
Conversation
Many of the Android TV platforms do not report accurate `SystemClock.elapsedRealtime()` In addition this drift is not consistant accross multiple boxes, so the time offset between any pair of boxes will vary over time. This variance will lead to a drift in the Live Offset calculation. Fix is simple, inValidate the NTP server query after a period of time (10 minutes) and re-issue the call
This looks good to me as in how this would work regarding reinitialization. Many thanks, Steve. I was wondering whether we want to use We would then wouldn't need to discuss how you came to choose 10 minutes as a default. :) You as a user could then opt-in once at app level using the How does adding a getter to override the default sound to you? |
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.
As mentioned in the main comment. Consider adding a getter to override the default of C.TIME_UNSET and disable reinitialization for C.TIME_UNSET?
@@ -49,6 +49,9 @@ public final class SntpClient { | |||
/** The default maximum time, in milliseconds, to wait for the SNTP request to complete. */ | |||
public static final int DEFAULT_TIMEOUT_MS = 1_000; | |||
|
|||
/** Max time to allow before re-initializing with NTP server, default is 10 minutes */ | |||
private static final long MAX_ELAPSED_MS_TILL_UPDATE = 60 * 10 * 1_000L; |
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.
UNTIL ? :)
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.
As mentioned in the PR comment. Is this a value that comes from your experience when operating live streams? I'm mostly curious...
This is what we also need, but could you remove hardcoded MAX_ELAPSED_MS_TILL_UPDATE? From our experience with media boxes that we have, the sync interval of 12 hours is adequate. |
Having it default to original behavior with a setter to enable the refresh (and set the time) sounds fine to me. It is possible this issue is limited to Android Streamers as phones likely time sync with the carrier. Also, for phones issuing the network request has at least some small battery penalty Feel free to add the commit with the change, you should have push access to the repo |
Ok, thanks! Will proceed that way. |
e186e9a
to
70f2d51
Compare
I pushed a commit with the getter and the release notes. I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review. Let me know if you see something, Steve. Else I proceed as described above. Thanks again! |
No worries. Feel free to force push or whatever you need, branch is yours
know.
We’ll update our side so code matches
…On Mon, Oct 21, 2024 at 10:55 AM Marc Baechinger ***@***.***> wrote:
I pushed a commit with the getter and the release notes. I'm going to send
this for internal review now. You may see some more commits being added as
I make changes in response to review feedback. Please refrain from pushing
any more substantive changes as it will complicate the internal review.
Let me know if you see something, Steve. Else I proceed as described
above. Thanks again!
—
Reply to this email directly, view it on GitHub
<#1794 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADBF6EJ6IMUQZXBWHKKVTDZ4U52HAVCNFSM6AAAAABPU4XPSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRXGM3DMOJZGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I have that CL ready for submission (see commits in this PR). May I ask you both how you are going to use that feature? Are you having your own media source that is using the client? I'm asking because when used with Once Is the use case for this change usage in [1] https://github.com/androidx/media/blob/release/libraries/exoplayer_dash/src/main/java/androidx/media3/exoplayer/dash/DashMediaSource.java#L715 |
In our case, users experience the issue when they bring the media box out of standby mode. During this process, we recreate the player (our wrapper with all the stuff) completely because the instance has been destroyed before entering standby, and I suspect we may still encounter some problems when users have been watching a live stream without turning the box off for a few weeks, right? In my opinion, this is a rare situation. |
Ah, I see. Yeah, obviously. Thanks for clarifying. I didn''t realized that it wouldn't re-initialize even when a new source is created. This case can be handled with this change as you say. The design of that Will submit as it is. If we need to enable this re-initialization inside the same |
PiperOrigin-RevId: 689121191 (cherry picked from commit b5615d5)
This is the equivalent pull request to #697, just rebased (with simple conflict resolve) to the main branch.
@marcbaechinger feel free to pick one and close the other.