Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banshee.GStreamer: Deinit gst before shutdown #2

Merged
merged 5 commits into from
Jun 17, 2017

Conversation

Carbenium
Copy link

Technically this isn't really necessary but it help to keep valgrind
logs cleaner

Copy link
Owner

@arfbtwn arfbtwn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I'm all for proper resource disposal 👍

EDIT: Just one more thing - if we hope to get things merged upstream (eventually) we'll need to follow GNOME's commit message guidelines, in our case I think that just means switching out the project name you've used as a tag, gstreamer or even just gst would be fine.

https://wiki.gnome.org/Git/CommitMessages

@@ -66,6 +66,7 @@ typedef void (* BansheeLogHandler) (BansheeLogType type, const gchar *component,

MYEXPORT void
gstreamer_initialize (gboolean debugging, BansheeLogHandler log_handler);
void gstreamer_deinitialize ();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will need MYEXPORT as above for the initialize function - I don't think its lack will bother us on GNU systems but maybe the windows folk need it?

return;
}

bp_debug ("Deinitializing GStreamer");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use banshee_log_debug below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Didn't pay enough attention when reading the code. 😄

@@ -209,9 +209,11 @@ protected override void Initialize ()

public override void Dispose ()
{
bp_stop (handle, true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. gst_deinit blocks until all GStreamer tasks are finished, so we need to stop playback before calling.

Copy link
Owner

@arfbtwn arfbtwn Jun 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still unsure we need this one since it appears to be called from bp_destroy, with this line commented out I still get this log when closing the program:

[1 Debug 15:01:55.078] (libbanshee:player) bp_stop: setting state to GST_STATE_NULL
[1 Debug 15:01:55.084] Player state change: Playing -> Idle
[1 Debug 15:01:55.087] (libbanshee:player) bp_destroy: disposed player
[1 Debug 15:01:55.087] (libbanshee:gst) Deinitializing GStreamer
[1 Debug 15:01:55.089] Service disposed (PlayerEngine)
[1 Debug 15:01:55.098] Service disposed (SourceManager)
[1 Debug 15:01:55.101] Service disposed (DbConnection)

EDIT: hmm, not from bp_destroy (I just looked) but definitely from somewhere.

EDIT2: found it... the base.Dispose call is calling back out to the Close function here which executes bp_stop - bit weird but let's leave that as is for now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called from PlayerEngine.Close. I had the deinit call previously somewhere else where it didn't work without bp_stop.
I'll remove the call.

Technically this isn't really necessary but it helps to keep valgrind
logs cleaner
@@ -39,6 +39,7 @@
#include <gst/pbutils/pbutils.h>

#include "banshee-gst.h"
#include "banshee-player-private.h"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last thing, I don't think we need this line :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn. Thanks 😋

Copy link
Owner

@arfbtwn arfbtwn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome man, nice work, squash it down into a single commit and it'll be ready for merging 👍

I haven't looked at the native player engine but looking through your commit logs it looks like I made the right choice in sticking with it

@Carbenium
Copy link
Author

Thanks. Still trying to get accustomed to the code base, so excuse me for the lengthy discussion.

On a side note: GitHub has the feature to squash the commits directly during the merge. Look at the arrow on the merge button.

@arfbtwn arfbtwn merged commit 6fdf7ad into arfbtwn:master Jun 17, 2017
@arfbtwn
Copy link
Owner

arfbtwn commented Jun 17, 2017

Knew it - thing put the pull request title in the commit message for the squash. I really hate that button - just force-pushed the right commit (4f39dd5) for this back out.

@arfbtwn
Copy link
Owner

arfbtwn commented Jun 17, 2017

Don't worry about going through a bit of discussion - that's what issues and pull requests are for, thanks again for the input 👍

@Carbenium Carbenium deleted the gst_dispose branch June 17, 2017 14:52
@Carbenium
Copy link
Author

I haven't looked at the native player engine but looking through your commit logs it looks like I made the right choice in sticking with it

Should I create an issue to track this?

@arfbtwn
Copy link
Owner

arfbtwn commented Jun 17, 2017

Perhaps, yes, I noticed you'd removed the GStreamerSharp backend - I think your message said the bindings library was unmaintained

@Carbenium
Copy link
Author

Exactly. It's unmaintained, doesn't ship with any large distro and it couldn't play a track.
So pretty useless in my opinion 😄

@arfbtwn
Copy link
Owner

arfbtwn commented Jun 17, 2017

Agreed, did you get that behaviour even with their master branch?

I remember experimentally trying it out - had to make some changes to Banshee to get it to compile, see bb1ac56, think I tried it out and it was working at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants