Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
gst-plugins-good
gst-plugins-good
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 613
    • Issues 613
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 107
    • Merge Requests 107
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GStreamer
  • gst-plugins-goodgst-plugins-good
  • Issues
  • #566

Closed
Open
Opened Feb 11, 2019 by Kristofer@BjorkstromContributor

matroskademux: race when src pads are created

A race condition exists in matroska-demux.c

When it occurs: The application thread, AT is changing state from PAUSED->READY. The Streaming thread, ST is in the process of setting up a src pad eg Audio. ST is in the process of creating the src PAD and concurrently AT is closing down the same src PAD.

I our specific case the problem was seen when the signal "pad-added" was calling a callback (in ST). That callback will do linking. But when it tried to get the src PAD caps by gst_pad_get_current_caps there were no caps. They had been removed precisely before by AT.

AT was doing: gst_element_change_state_func -> gst_element_pads_activate (element, FALSE) ->gst_pad_set_active->>activate_mode_internal> post_activate->remove_events (pad)

ST was doing: gst_matroska_demux_add_stream -> "pad-added" signal CB

One possible solution is to add a gst_pad_set_activatemode_function to each src PAD created. In that function one calls gst_pad_stop_task (src PAD) that will stop the ST and join it with AT. At least one downside with this proposed solution is that the gst_pad_stop_task will be called several times once from sink and some from the src PADs (now only sink PAD has a gst_pad_set_activatemode_function that closes down the ST by calling gst_pad_stop_task). Also the Streamin thread probably belongs to sink PAD not to src PAD/PADs.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: gstreamer/gst-plugins-good#566