-
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
Seeking accuracy and error in version 2.7.0 #3913
Comments
@andrewlewis its not typo but actually we see error ranging till 700 ms. yes CT 1 is current system time at which player has seeked to point x1 and ready to play. and yes the stream has just audio in mp4 format. previously also we were facing this problem then we spliced the big file of 100 minutes in small parts of 5 minutes so that file size becomes small and this lag is decreased . it had improvement but still error in AMPP(actual media player position) returns with error of 100s of ms when compared with IMPP (ideal media player position.: which is the position of the played it should have been ideally if no lag would have occurred.) to solve this we were trying to seek again and again after 1 sec hoping for correction but i believe that is like temporary lucky patch and not reliable. pls help. thanks |
I don't really understand what the problem is.
This is incorrect. At time CT1 the player will start to buffer media from the newly specified seek position, possibly over the network depending on where your media is located. So playback wont start immediately, but will instead start some time later (CT1+bufferingTime). So at (CT1+t) you'd actually expect the playback position to be (x1+t-bufferingTime). Is the problem that once playback does start, you see the position advancing slightly slower than you expect, causing a drift that gradually increases over time? If so then it's unclear why, but it's the underlying platform that's controlling the rate of output. At the ExoPlayer level we're just reporting the playback position in the media that's been reached, and I'm pretty sure we're doing this correctly. Also, if this is the issue, then why is it actually a problem for the app you're developing? What's the use case that you need to implement? If you're trying to synchronize something to the media then you should use the playback position that ExoPlayer reports (and if there is drift, poll the position frequently). |
@ojw28 what you are saying is correct that at CT1+t the player should be at the x1+t-buffer time or say at CT1+t+buffer time the player would be at (x1+t). secondly we understand that APP can have error of +/- 50 ms when we get it from the player , thirdly the player will take max 500 ms to stabilize after seeking , fourthly the player will seek to nearest frame and as we are playing 24fps /25fps content by this logic it should at least seek with an max error of 40-45 ms but its not the case as what we observed. Use case: we are doing second screen/ multiple screen synchronization so we need to seek accurately at least with the accuracy of 100ms (max). i hope that you must have got the problem . please help. thanks. |
I think the problem is being described in a way that's more complicated than is necessary, which is making it pretty hard to follow what you're actually observing. Does your media have audio? If so is there any audible discontinuity during playback? Are you sure the player doesn't stop to re-buffer? If audio sounds smooth then it's difficult to see how we'd get that far out of sync with the realtime clock. I'm pretty confident our reported positions accurately reflect where playback has reached in the media being played, and we've not had anyone else report this kind of issue despite ExoPlayer being widely used. The above aside, at a high level, I don't think you're ever going to get the kind of synchronization you need for this use case with the approach you're trying to use. If you need to synchronize multiple screens then you really need to inject a properly synchronized (e.g. with NTP) into ExoPlayer, and use that to drive the playback. We don't support this use case directly, but I know people have done this successfully in the past by digging around in ExoPlayer's internal. |
@KKXLC did you get any solution in this issue?? @ojw28 This is the actual issue which I also observed in ExoPlayer. I have a time T1 at which I have to seek my my audio. Following is the code: player.seekTo(T1); When I have put a log in onSeekProcessed() and onPlayerStateChange() methods. @OverRide Ideally after 1 sec = 1000 ms it should be at 145625356 however there is a clear difference of 193. I executed same steps 4 5 times however, all the time getCurretPosition is giving different values. NOTE All the media files are locally stored at the mobile phone. I am not streaming on network. @ojw28 and @andrewlewis could you please put some light on this uncertain behavior of the player. Please suggest something in this regard. |
Position discrepancies of less than about 130 milliseconds may be down to the audio track position not increasing perfectly linearly, tracked by #3841. |
@vikas3121 Just to emphasize it again. The difference of 193 ms you are seeing is most likely the time needed to rebuffer the media from the seek position. Can you make your measurements from onPlayerStateChanged to STATE_READY which is when the player finished buffering and starts playing? |
Yes. The audio track position non-linearity is only really relevant once you're measuring the point at which the player becomes ready correctly, and are compensating for any buffering that occurs (both in response to the seek and later on before you sample the position). |
I think you're just not properly synchronizing with when playback actually starts. Playback does not start instantly. |
@ojw28 I have performed several observations and following are stats: I have used one mp4 file and log time are also saying something for the performance of this. step 1: seeked player to say x1= 5000 ms and noted the current time as CT1 called first time. step 2: re seeked player after 3sec at CT2 called to point x2=10000ms. step 3:monitored player state: printed CT2@Buffering,CT2@ready in the second seek and calculate Buffer time as BT2. 03-01 20:46:35.450 14712-14712/com.test.exoplayer E/ChunkAudioPlayer: __ STATE_BUFFERING __ At this position player should be at 11006 ms however it was at 10795 ms . Deviation received was of 205 milliseconds. Similarly when we seeked it at 10000 ms after 3 seconds of first seek it should be at 8000 ms before seek however it was at 7668 milliseconds. It took 305 milliseconds as buffering time to be in state ready from the seek call. Following is the code snippet for the same:
|
I'm able to reproduce similar results, although I can't get a deviation any higher than ~100ms. I have no idea how you're able to get such a high deviation, although it could be a result of your app performing a lot of work on its main thread (see below). As previously stated, I think you're just not properly synchronizing with when playback actually starts. There are multiple reasons why So I think in conclusion:
|
still facing problem in seeking accurately in Exoplayer. we are facing this problem of inaccurate seeking when ever we are trying to seek to a time or play the file from a particular time.
say if we start playing a media file *.mp4 (<15mb) to a particular point say "x".
if we play a file giving the player position from were it has to play that media it seeks to that position and stat playing but inaccurately. to get error we did below steps:
we again seek to point "x1" at current time CT1.
so the player position will change as the time changes so it means at time (CT1+t) the player position should be at (x1+t).
but when we fetch the player position at (CT1+t) we are getting (x1+tt). so (tt-t = e), e is the error which ranges from 700 ms to 100 ms easily.
we are playing media at 1x player speed and content is fixed 24fps or 25 fps.
please help. how to remove this error and get at least 50 ms accuracy.
The text was updated successfully, but these errors were encountered: