After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796690 - A bug in PlaybackTutorial7.cs
A bug in PlaybackTutorial7.cs
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-sharp
1.14.1
Other Windows
: Normal normal
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-06-27 02:43 UTC by tomislavtustonic
Modified: 2018-10-12 12:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a patch for PlaybackTutorial7 (998 bytes, patch)
2018-06-27 02:43 UTC, tomislavtustonic
none Details | Review
a patch for PlaybackTutorial7 (1.64 KB, patch)
2018-10-11 22:44 UTC, tomislavtustonic
committed Details | Review

Description tomislavtustonic 2018-06-27 02:43:00 UTC
Created attachment 372841 [details] [review]
a patch for PlaybackTutorial7

Hello

There is a bug in PlaybackTutorial7.cs (https://github.com/GStreamer/gstreamer-sharp/blob/master/samples/PlaybackTutorial7.cs)

In the original tutorial the pipelines custom audio-sink is set before starting playing, while in C# the custom sink is set after. The result is that equalizer has no effect. 

When I set the audio-sink before playing (see a patch), the equalizer works fine, but when setting pipeline state to State.Null I get the following exception:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Gst.Element.gst_element_set_state(IntPtr raw, Int32 state)
   at Gst.Element.SetState(State state)
   at GstreamerSharp.Playback.Main(String[] args) in ...\PlaybackTutorial7.cs:line 61

Should I open the new bug for this AccessViolationException ?

Cheers, Tom
Comment 1 Thibault Saunier 2018-10-10 19:26:22 UTC
Could you please provide the patch with `git format-patch`: ttps://gstreamer.freedesktop.org/documentation/contribute/index.html

(In reply to tomislavtustonic from comment #0)
> Created attachment 372841 [details] [review] [review]
> a patch for PlaybackTutorial7
> 
> When I set the audio-sink before playing (see a patch), the equalizer works
> fine, but when setting pipeline state to State.Null I get the following
> exception:
> 
> Unhandled Exception: System.AccessViolationException: Attempted to read or
> write protected memory. This is often an indication that other memory is
> corrupt.
>    at Gst.Element.gst_element_set_state(IntPtr raw, Int32 state)
>    at Gst.Element.SetState(State state)
>    at GstreamerSharp.Playback.Main(String[] args) in
> ...\PlaybackTutorial7.cs:line 61
> 
> Should I open the new bug for this AccessViolationException ?
> 
> Cheers, Tom

What version are you testing with? - Please try to reproduce with master and pretty please open a new bug :-)
Comment 2 tomislavtustonic 2018-10-11 22:44:41 UTC
Created attachment 373901 [details] [review]
a patch for PlaybackTutorial7
Comment 3 tomislavtustonic 2018-10-11 23:20:42 UTC
Here's a patch, hope it's OK.

As for your other comments:
- I tested with the GstSharp 1.14.2 Nuget package
- I didn't compile gstreamer-sharp from the master, because it doesn't build in Visual Studio. Meson requires to setup c compiler, python etc, and I don't have the time ATM.
- Original bug is GStreamer version is 1.14.1
- didn't test with 1.14.2, because of this bug: https://bugzilla.gnome.org/show_bug.cgi?id=796858
- there's no access violation exception with the GStreamer 1.14.4, so it seems to be fine (but the sample is still broken and the patch fixes it).

As a suggestion, could it be possible to refactor gstreamer-sharp VS solution into two projects - Sources and Samples? It is quite hard to build this way with the samples included. 
Also, it targets the .Net 2.0 which is too old. It's much better to use .Net standard. Mono 5.4 supports .Net standard 2, and Mono 4.6 supports .Net standard 1.6 (I tried with 2.0, but perhaps 1.6 would be sufficient).

If you're interested I can zip and send you a refactored VS solution.

Thanks, cheers,
Tom
Comment 4 Thibault Saunier 2018-10-12 12:23:04 UTC
I do not get the exception when setting the pipeline to NULL on master, I believe that was fixed a while back.

> Also, it targets the .Net 2.0 which is too old. It's much better to use .Net standard. Mono 5.4 supports .Net standard 2, and Mono 4.6 supports .Net standard 1.6 (I tried with 2.0, but perhaps 1.6 would be sufficient).

Well, I want to target .net standard but using meson, not VS solution. Ideally meson should be able to generate the solution (not the case yet).