Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gstreamer-sharp gstreamer-sharp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 36
    • Issues 36
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gstreamer-sharpgstreamer-sharp
  • Issues
  • #13

Closed
Open
Created Nov 21, 2018 by Tomislav Tustonic@ttustonic

Gst.Object.Replace doesn't seem to work

Hello

I'm trying to create a player, similar to (https://github.com/GStreamer/gst-plugins-base/blob/master/tools/gst-play.c)
In the handler for GST_MESSAGE_STREAM_COLLECTION (line 534) there's a call to gst_object_replace. If I understand correctly, it's supposed to replace an old collection with the new by replacing the pointers.

I try to use Gst.Object.Replace, but it doesn't seem to work and there's an error:
(GstPlayer.exe:19812): GStreamer-CRITICAL **: gst_object_replace: assertion 'oldobj != NULL' failed

When I look at the code for the Replace method it seems that there are a few errors.

  • The gst_object_replace takes a **, so the import should probably be
    static extern bool gst_object_replace(ref IntPtr oldobj, IntPtr newobj); // note the ref oldobj
  • Also, the Replace method should also take a ref Gst.Object oldobj parameter.
  • In the case when the oldptr==null , the IntPtr value sent to the gst_object_replace is not an OwnedHandle of the oldobj, so the oldobj doesn't change.
  • However, since handles in Gst.Object cannot just be replaced, when gst_object_replace returns true, a new value for the oldobj needs to be created with the replaced handle.

Attached are the test and the patch. There are two versions of Replace, a generic and non-generic. Test shows the usage for both of them.

Hope it's OK, Tom

TestStreamCollection.cs 0001-A-fix-for-a-Gst.Object.Replace-in-Object.cs.patch

Assignee
Assign to
Time tracking