Repository navigation
cefsrc: discard data in the PAUSED state - #112
Conversation
|
The following is a detailed Claude analysis. I always feel bad sharing raw analysis but, unfortunately, this area is a bit beyond me and it was Claude who executed all the tests. I have read through it all and it seems accurate to me as far as I can tell. Test results for this PR on macOS/arm64 with CEF 144. Setup details are at the end. The change works for the case it targets: with the pipeline parked in PAUSED, 1. The audio guard is in the wrong callback, and it crashesThe guard at L306 sits in The consequence is worse than the audio list simply going unbounded. buf = gst_buffer_new_allocate (NULL, mChannels * frames * 4, NULL); // L336
for (i = 0; i < mChannels; i++) { gfloat *cdata = (gfloat *) data[i]; // L339 — also reads past data[]A pipeline that starts in PAUSED on a page producing audio aborts as a result. The two relevant log lines appear consecutively: The backtrace confirms the allocation as the faulting call: Because CEF installs PartitionAlloc process-wide, the invalid size becomes a The trigger is simply a pipeline that starts in PAUSED while the page produces audio; it reproduced in all four attempts, aborting after about six seconds. Building the same test against neighbouring revisions isolates it to this PR:
#111 does not mask the crash, which is expected — the uninitialized read is unrelated to whether the queues are bounded. It is worth noting that the missing initialization of 2. Discarding the stream-start event also loses the audio capsThis is independent of the crash and would survive fixing it. The Moving the guard to 3. The queues still grow outside the PAUSED stateThe measurement below warms the pipeline up in PLAYING, holds it in PAUSED for 30 seconds, then returns it to PLAYING, running 1080p against an animating page with looping audio.
Two things stand out. The first is that audio in PAUSED is entirely unaffected: there were no discards at all across the hold, and the queue climbed monotonically from 1 to 321 entries at roughly one per 93ms, draining only once the pipeline resumed. That is the direct consequence of the placement problem in §1. The second is that the frame queue reached 34 buffers while the pipeline was PLAYING, during startup, before PAUSED had been entered at all — around 280 MB nominal at 1080p. RSS understates this, as the synthetic test frames compress well, so queue depth is the more reliable metric of the two. This is the structural limit of a state check: the queue grows whenever 4. Unsynchronized state readA minor point: AssessmentFor the PAUSED case this approach is preferable to a cap. Not allocating is strictly cheaper than allocating and then dropping, and it retains nothing rather than a couple of frames, which the measurements bear out — 204 frames discarded with RSS flat across the hold. The limitation is that it is a state check rather than a bound, so it does not address §2 or §3. The two PRs therefore look complementary rather than alternative: this one as the fast path for the common stall, and a cap as the backstop that bounds the queues independent of state. #111 could be rebased into that narrower role on top of this PR, or dropped in favour of fixing the audio path here, depending on how much surface is wanted. §1 is the blocking issue for merging as submitted. Test setupmacOS 15 / arm64, CEF 144.0.21, GStreamer 1.28.6, Apple clang 21. All four builds also carry #110, which is required to compile on macOS against CEF 144 at all. Those changes are limited to CMake and The pipeline under test was One note for anyone reproducing this on macOS: cefsrc deliberately does not call |
cefsrc is a live element, and shouldn't queue any data until it has reached the PLAYING state. See #111
b25cb54 to
7242f6a
Compare
|
Fixed location of the audio check. Regarding queues growing in PLAYING, this can be solved externally without adding new properties, just place leaky queues downstream. |
cefsrc is a live element, and shouldn't queue any data until it has reached the PLAYING state.
See #111