Skip to content
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

Playback stuck when failed to locate next period due to floating point error #882

Closed
albertcsm opened this issue Jun 14, 2017 · 5 comments
Closed
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@albertcsm
Copy link
Contributor

Hi, I am playing a multi-period DASH, and encounter playback stuck.

Shaka tried to locate the period by (last period start time + last segment end time in period), but the number ended up slightly less than the start time of the next period due to floating point error. Consequently, Shaka incorrectly looked up the the segment from the last period, and never advance to the next one.

There were console logs showing that Shaka tried to buffer segment at time 5.955944499999999s, but failed and keep retrying.

(audio:8) timeNeeded=5.955944499999999
18:53:03.026 streaming_engine.js:900 (audio:8) update_: playheadTime=5.50202 bufferedAhead=0.4939239999999998
18:53:03.027 streaming_engine.js:1030 (audio:8) next position known: position=2
18:53:03.027 streaming_engine.js:1130 (audio:8) segment does not exist: currentPeriod.startTime=1.001 position=2
18:53:03.027 streaming_engine.js:1879 (audio:8) updating in 1 seconds
18:53:03.042 streaming_engine.js:888 (video:6) timeNeeded=5.955944499999999
18:53:03.043 streaming_engine.js:900 (video:6) update_: playheadTime=5.50202 bufferedAhead=0.45392900000000047
18:53:03.043 streaming_engine.js:1030 (video:6) next position known: position=2
18:53:03.044 streaming_engine.js:1130 (video:6) segment does not exist: currentPeriod.startTime=1.001 position=2
18:53:03.044 streaming_engine.js:1879 (video:6) updating in 1 seconds
18:53:04.028 streaming_engine.js:888 (audio:8) timeNeeded=5.955944499999999
18:53:04.029 streaming_engine.js:900 (audio:8) update_: playheadTime=5.50202 bufferedAhead=0.4939239999999998
18:53:04.029 streaming_engine.js:1030 (audio:8) next position known: position=2
18:53:04.029 streaming_engine.js:1130 (audio:8) segment does not exist: currentPeriod.startTime=1.001 position=2
18:53:04.030 streaming_engine.js:1879 (audio:8) updating in 1 seconds
18:53:04.045 streaming_engine.js:888 (video:6) timeNeeded=5.955944499999999
18:53:04.045 streaming_engine.js:900 (video:6) update_: playheadTime=5.50202 bufferedAhead=0.45392900000000047
18:53:04.046 streaming_engine.js:1030 (video:6) next position known: position=2
18:53:04.046 streaming_engine.js:1130 (video:6) segment does not exist: currentPeriod.startTime=1.001 position=2
18:53:04.047 streaming_engine.js:1879 (video:6) updating in 1 seconds

The manifest looks like follows:

<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:scte35="urn:scte:scte35:2014:xml+bin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT50.0546222S" minBufferTime="PT8.0S" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd">
   <Period start="PT0S" id="1">
      ...
   </Period>
   <Period start="PT1.001S" id="2">
      <AdaptationSet mimeType="audio/mp4" startWithSAP="1" lang="eng" segmentAlignment="true">
         <SegmentTemplate timescale="10000000" presentationTimeOffset="1984022521601042" media="$RepresentationID$/Segment-$Time$.m4a" initialization="$RepresentationID$/init.m4i">
            <SegmentTimeline>
               <S t="1984022532077598" d="39680000" />
            </SegmentTimeline>
         </SegmentTemplate>
         <Representation audioSamplingRate="48000" codecs="mp4a.40.29" id="stream_1" bandwidth="48000" />
      </AdaptationSet>
      ...
   </Period>
   <Period start="PT5.9559445S" id="3">
      <AdaptationSet mimeType="audio/mp4" startWithSAP="1" lang="eng" segmentAlignment="true">
         <SegmentTemplate timescale="10000000" presentationTimeOffset="1984022571150487" media="$RepresentationID$/Segment-$Time$.m4a" initialization="$RepresentationID$/init.m4i">
            <SegmentTimeline>
               <S t="1984022571757598" d="49920000" />
            </SegmentTimeline>
         </SegmentTemplate>
         <Representation audioSamplingRate="48000" codecs="mp4a.40.29" id="stream_1" bandwidth="48000" />
      </AdaptationSet>
      ...
   </Period>
</MPD>

I verified that the error is caused by floating point error by computing 1.001 + 4.9549445 in console, which gives 5.955944499999999.
(1.001 is start time of period "2" and 4.9549445 is the end time of the last segment in period "2" after fitting to the period boundary between period "2" and "3").

I have opened similar issue before (#694) but seems the fix is incomplete.

Thanks in advance.

@ismena
Copy link
Contributor

ismena commented Jun 26, 2017

@TheModMaker I'm assigning this to you because you fixed #694 that seems to have been similar and is referenced in this issue.
Could you please check if this is related?

@TheModMaker
Copy link
Contributor

@albertcsm Can you provide a playable version of the manifest? You can send it privately to shaka-player-issues@google.com if you want.

@TheModMaker TheModMaker added type: bug Something isn't working correctly and removed needs triage labels Jul 5, 2017
@TheModMaker TheModMaker added this to the v2.2.0 milestone Jul 5, 2017
@TheModMaker
Copy link
Contributor

@albertcsm Another user reported a similar issue, so I think the fix will apply to you as well. If the issue persists, feel free to reopen.

@albertcsm
Copy link
Contributor Author

Thanks

joeyparrish pushed a commit that referenced this issue Jul 17, 2017
Closes #882
Closes #909
Closes #911

Change-Id: Id31567137860b6bd683169b5b68ca83d6f14473d
@joeyparrish
Copy link
Member

The fix for this has been cherry-picked and will be released in v2.1.5.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants