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 614288 - Setting playbin volume has no effect the second time around
Setting playbin volume has no effect the second time around
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.28
Other Linux
: Normal normal
: 0.10.29
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-03-29 20:03 UTC by Thomas Green
Modified: 2010-04-09 06:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
don't unref volume element in remove_sinks (1.39 KB, patch)
2010-04-08 22:09 UTC, Thomas Green
committed Details | Review

Description Thomas Green 2010-03-29 20:03:14 UTC
If the playbin is used to play many media files then the volume can only be adjusted when the first file is playing, for any subsequent files (that use the same playbin) it has no effect.

Here is a quick example in python, replace references to '/home/tom/test.oga' with a media file on your system.


#!/usr/bin/python
import pygtk, gtk, gobject
import pygst, gst

def change_uri():
	print "attempting to play again, but louder"
	pipeline.set_state(gst.STATE_NULL)
	pipeline.set_property("uri", "file:///home/tom/test.oga")
	pipeline.set_state(gst.STATE_PLAYING)
	pipeline.set_property("volume", 1.0)

pipeline = gst.parse_launch('playbin uri=file:///home/tom/test.oga')

pipeline.set_state(gst.STATE_PLAYING)
pipeline.set_property("volume", 0.1)

gobject.timeout_add(6000, change_uri)
gtk.main()


It should playback at a low volume (10%) and after 6 seconds the callback restarts playback and increases the volume (100%), but instead playback restarts with the lower volume. It is interesting to note that playbin2 works fine in the same example!

I hope someone else can reproduce this problem, as far as I can tell I have all the latest core/plugin releases installed.
Comment 1 Sebastian Dröge (slomo) 2010-04-02 17:16:35 UTC
It's unlikely that anybody will fix this for playbin because using playbin2 is now recommended and it works there... as such I'll close this bug as WONTFIX unless you (or anybody else) wants to work on this for old playbin.

Is there any reason why you don't want to use playbin2?
Comment 2 Thomas Green 2010-04-02 22:25:24 UTC
The main reason I still rely on old playbin in some cases is down to the lack of working DVB playback with playbin2, so it seemed like a good idea to still support playback with both.

Anyway, I'll see if I can find where the regression was introduced and maybe I can understand what's going wrong.
Comment 3 Thomas Green 2010-04-08 22:04:17 UTC
A git bisect points at the following commit:

http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=e9d1819fe390e6c6d2d664387922e28003da470e

It looks like unref'ing the volume element in remove_sinks is the cause of the behaviour I am seeing. This is because subsequent calls to gen_audio_element (e.g. for the next media file) don't re-create the volume element. gen_audio_element checks the cache for a "abin" (and returns it) and never gets as far as creating the volume element again.
Comment 4 Thomas Green 2010-04-08 22:09:12 UTC
Created attachment 158241 [details] [review]
don't unref volume element in remove_sinks

This simple patch only unref's the volume element when the playbin is disposed of or a new audio_sink is set on the playbin, after which gen_audio_element should re-create it.
Comment 5 Sebastian Dröge (slomo) 2010-04-09 06:25:15 UTC
commit 57b64c001a0a5c4e2008f61afb607c147e05a773
Author: Thomas Green <thomasgr33n@googlemail.com>
Date:   Fri Apr 9 08:23:33 2010 +0200

    playbin: Only unref the volume element on dispose and when a new audio sink is set
    
    Unreffing it whenever the sinks are removed will make the volume
    element unavailable after a playbin reuse because it is only
    recreated if the audio sink has changed.
    
    Fixes bug #614288.