VPLAY-12498 gstreamer test harness - robustness: Track Destructor Enhancement and Comprehensive Pipeline::Reset#922
Merged
pstroffolino merged 5 commits intodev_sprint_25_2from Jan 28, 2026
Conversation
Reason for Change: Cleans up global Mp4Demux instances - Prevents memory leaks from accumulated demuxers Flushes track queues - Removes stale TrackEvent objects that could reference freed memory Resets pipeline state - Sets to NULL before deletion Recreates clean pipeline - Fresh instance without baggage Resets context state - All counters and flags back to initial values Resets track state - Clears needsData and injection flags This should significantly improve stability when stopping and playing different streams. The fix addresses the root cause of the crashes: incomplete cleanup leaving dangling pointers and stale state. Test Guidance: use gst test harness to play different streams and tests and confirm no crashes Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
…ancement and Comprehensive Pipeline::Reset Reason for Change: Fix #1 - Track Destructor Enhancement: Now calls Flush() before deleting the queue Ensures all TrackEvent objects are properly deleted Prevents memory leaks when Track objects are destroyed Fix #2 - Comprehensive Pipeline::Reset(): Clears the seek queue (original behavior) Resets configured_stream_count to 0 Resets initial_seek_performed to false Clears injected seconds counters for all media streams Provides detailed debug logging These fixes create multiple layers of protection: Stop command (Fix #1) - Explicit cleanup when user stops playback Track destructor (Fix #2) - Automatic cleanup when Track objects are destroyed Pipeline::Reset() (Fix #3) - Comprehensive state reset that can be called by other methods like Flush() Together, these should significantly improve stability when: Stopping and playing different streams Switching between DAI tests Recovering from errors Handling rapid state transitions The code now has proper cleanup at multiple lifecycle points, reducing the chance of crashes from stale state or memory leaks. Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Improves robustness of the GStreamer test harness by strengthening cleanup/reset behavior across stop/teardown paths and by making pipeline context inheritance compatible with PipelineContext* usage.
Changes:
- Make
MyPipelineContextpublicly inheritPipelineContextso it can be passed safely as aPipelineContext*. - Ensure
Trackcleans up queuedTrackEventobjects on destruction and add additional cleanup/reset steps on thestopcommand. - Expand
Pipeline::Reset()to reset more internal state (seek queue + config state + injected counters).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/gstTestHarness/gst-test.h |
Public inheritance for MyPipelineContext to enable correct upcasting to PipelineContext*. |
test/gstTestHarness/gst-test.cpp |
Adds queue flushing in Track destructor and extends stop command cleanup/reset logic. |
test/gstTestHarness/gst-port.cpp |
Enhances Pipeline::Reset() to fully reset seek/config state and injected counters. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VPLAY-12498 gstreamer test harness - robustness: Track Destructor Enhancement and Comprehensive Pipeline::Reset
Reason for Change:
Fix #1 - Track Destructor Enhancement:
Now calls Flush() before deleting the queue
Ensures all TrackEvent objects are properly deleted
Prevents memory leaks when Track objects are destroyed
Fix #2 - Comprehensive Pipeline::Reset():
Clears the seek queue (original behavior)
Resets configured_stream_count to 0
Resets initial_seek_performed to false
Clears injected seconds counters for all media streams
Provides detailed debug logging
These fixes create multiple layers of protection:
Stop command (Fix #1) - Explicit cleanup when user stops playback
Track destructor (Fix #2) - Automatic cleanup when Track objects are destroyed
Pipeline::Reset() (Fix #3) - Comprehensive state reset that can be called by other methods like Flush()
Together, these should significantly improve stability when:
Stopping and playing different streams
Switching between DAI tests
Recovering from errors
Handling rapid state transitions
The code now has proper cleanup at multiple lifecycle points, reducing the chance of crashes from stale state or memory leaks