Repository navigation
FEL route: recover from session loss (#739), drain the decoder at end of stream - #784
Conversation
…dropping them `flush()` raises `draining` and moves the delivery epoch before it drains the sessions, so everything VideoToolbox, the GPU and the pairing queues still hold is dropped. That is right for a seek, but the host also calls `flush()` at end of stream, right after feeding the last packet, and there it drops the last frames of every title. `drainForEndOfStream()` drains both sessions without the gate, sends any base-layer frame still waiting for its enhancement layer out alone under its ticket, and returns once the frames have reached `onFrame` (or after 0.5 s with a composition still on the GPU).
At end of media, at the end of a DVR ring and at a timeline seam the host flushes the video decoder right after feeding the last packet. On the FEL route that flush drops the frames the sessions and the GPU still hold, so the last frames of every title never reached the layer. Drain them first.
…sessions The host recovers from a session the system invalidated (AE#739) only through `HardwareVideoDecoder`: it installs `onSessionLost` and calls `rebuildSession()` on that type alone. On the FEL route neither sub-decoder had a handler, so a session lost to a screen lock or a media-services reset was never noticed and the layers dropped every later packet: video stayed frozen while audio played on. `VideoSessionRebuilding` names the two members the host uses; both decoders conform. The dual-layer decoder hands the handler to both sub-decoders (and to the enhancement decoder when it opens), and rebuilds both sessions, then puts both back on its own feed epoch: each sub-decoder's rebuild moves its epoch, and the packets the host feeds carry the owner's.
…tes them The AE#739 recovery (handler, rebuild on loss and on the foreground return) looked only for `HardwareVideoDecoder`, so on the dual-layer route a lost session froze the video for the rest of the session. Go through `VideoSessionRebuilding`, which both decoders implement.
…e per layer A screen lock invalidates both sessions and each sub-decoder reported it, so the host rebuilt both sessions twice and repositioned twice for one event (seen with aetherctl bgaudio --lose-session --fel). The sub-decoders now report through the dual-layer decoder, which passes the first loss on and the rest only after rebuildSession() has replaced both sessions.
fel22StreamClassificationAndPacketBalance compared the process-wide PacketBalanceTracker.alive before and after, so any suite allocating or freeing packets in parallel failed it now and then. DEBUG builds get a task-local PacketBalanceTracker.Scope; the test counts only its own task. longRunStable asserted on the process's resident memory, which grew by 420 to 480 MiB in full runs while the test alone stayed flat at about 106 MiB. The bound is now asserted only on request, for a run on its own (DV_FEL_MEMORY_SOLO=1); the frame and stall checks always run.
… checks under parallel runs)
…ain, session rebuild)
…route counts as VideoToolbox; epoch-adoption and drain-dispatch tests
…unds the drift instead
… dual-layer route
The one-lane trait serialises a case behind every other lane case, and the wait counts against the case's .timeLimit. On the CI runner the fuzz suites hold the lane for ~85 s, so DualLayerStreamClassificationTests and DualLayerGpuSlotWaitTests hit their 1-minute limit before they ran. The four dual-layer suites with a time limit are hang watchdogs parked on VideoToolbox or a semaphore, not CPU loops, so they take the plain .offCooperativePool, as the trait's comment already asks of DoviComposeAsyncTests.
3221fe8
into
superuser404notfound:main
|
Merged in 3221fe8, thanks @pkajaba. This closes the two conditions from the #770 merge comment, plus the Reviewed against main:
One change from the branch: in the conflict with main, the dual-layer suites keep The two smaller notes (the Before a consumer turns |
Follow-up to #770, for the two points in the merge comment. Both only matter with
preferDualLayerDolbyVisionon.What's in it
VideoSessionRebuildingnames what the host's recovery uses (onSessionLost,rebuildSession());HardwareVideoDecoderandDualLayerVideoDecoderconform, andexitBackgroundAudioOnly/recoverVideoSessiongo through the protocol instead ofas? HardwareVideoDecoder. The dual-layer decoder fansonSessionLostin from both sub-decoders and reports one loss per event (a screen lock invalidates both sessions), andrebuildSession()rebuilds both and re-adopts the feed epoch the sub-decoders' rebuilds bump. Pairing state is reset by the host's flush around the rebuild: before it on the background return, and by the reposition seek after it inrecoverVideoSession(the route is seekable VOD, so the live no-reposition branch does not apply). A DEBUG hook lets the AE#739 harness (aetherctl bgaudio --lose-session --fel) invalidate both sessions.VideoDecodingPipeline.drainForEndOfStream(), a no-op for decoders whoseflush()already delivers what they owe. The dual-layer decoder waits on VideoToolbox with pairing live, sends a base frame still waiting for its enhancement layer out alone on its own ticket, and returns once the frames have reachedonFrame(or after 0.5 s with a composition still on the GPU). The host calls it before the VOD end-of-source flush; it also calls it at the DVR-ring end and the timeline seam, which the route cannot reach today (seekable VOD only) and where it is a no-op forHardwareVideoDecoder. Seeks keep the discardingflush().makeBlockBuffer's failure path releases the block source's retain only whenFreeBlockhas not already run (a flag the free callback sets), so it is right whichever way CoreMedia behaves afterAllocateBlockfails.DoviFelRealFileTestscan run alone (DV_FEL_MEMORY_SOLO), so parallel suites do not disturb their footprint numbers. Skipped withoutDV_FEL_TESTS_DIR.How it was tested
mainmerged:swift test4784 tests in 645 suites, andLIBDISPATCH_COOPERATIVE_POOL_STRICT=1 swift test --skip-build --disable-xctest4784 in 645, green.DualLayerVideoDecoderTests: end-of-stream delivery (base frames with and without an EL partner arrive in order, the following flush delivers nothing), seek flush still discards, one loss reported per event,rebuildAdoptsFeedEpoch,drainDispatchesThroughProtocol.aetherctlwith the feat(aetherctl): FEL playback, survey and diagnostics tooling #772 tooling, a 120 s Profile 7 FEL clip):enq=240 disp=240 lost=0, the last at 119.995 s), 0 compose failures. Route off also plays to the end.bgaudio --lose-session --fel: each of the two sessions invalidated once and rebuilt once, video resumes after the background return, 0 compose failures.Not in it
The two smaller notes (the
el_typeprobe's unbounded seek back to 0, no byte budget incompleteHEVCRecordFromInBandParameterSets). Happy to send them separately if you want them.