• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: VWR-5659
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Tofu Linden
Reporter: Michelle2 Zenovka
Votes: 4
Watchers: 7
Operations

If you were logged in you would be able to see more operations.
1. Second Life Viewer - VWR
VWR-2662

Implement audio streaming via gstreamer

Created: 15/Mar/08 01:43 PM   Updated: 14/Mar/09 08:44 PM
Return to search
Component/s: Sound, Source Code
Affects Version/s: Source code
Fix Version/s: 1.19.1 Release Candidate, 1.22

File Attachments: 1. Text File gstreamer_audio_1.19.1.2.patch (6 kB)
2. Text File gstreamer_audio_1.20.6.patch (6 kB)
3. Text File openal_idle_with_updateMedia.patch (0.4 kB)
4. Text File openal_patch_1_20_7_llmedia_broken.patch (29 kB)
5. Text File openal_patch_1_20_9_works.patch (30 kB)

Environment: Any that wants to be free of FMOD
Issue Links:
Relates
 

Last Triaged: 21/Aug/08 01:31 PM
Source Version: 1.19.1.2
Linden Lab Issue ID: DEV-12518
Patch attached: Patch attached
Linden Lab Internal Branch: viewer-1.22.11


 Description  « Hide
Sub task to implement streaming audio via gstreamer.

OpenAL itself does not support streaming and it is fairly trivial to hijack the existing streaming media class and give it a URL of an audio source and it just plays fine.

Note the gstreamer patches on VWR-2662 are now broken on 1.19.1, new ones will appear on this JIRA.

Basic issue is that audio is now initalised before gstreamer DSO symbols are loaded so trying to create a private instance of LLMediaImplGStreamer crashes on viewer startup. Solution init the streaming audio after the symbols are loaded.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Michelle2 Zenovka added a comment - 15/Mar/08 04:44 PM
Patch attached to get streaming audio once again working with openAL. This should at least keep you all going for 5 minutes!.

I will now start work on a separate patch that is independent of openal, which i hope to be the one that gets included in the viewer.


Whoops Babii added a comment - 12/May/08 02:23 PM
For those who can't wait for Michelle's non-openal version of audio streaming, take a look at gstreamer_audio_1.20.6.patch. This includes the minor change required to initialize GStreamer prior to instantiating the LLMediaImplGStreamer class. That is:

mMedia_data = new LLMediaManagerData;
LLMediaImplGStreamer::startup( mMedia_data ); // initialize GStreamer

before:

m_streamer=new LLMediaImplGStreamer ();

That simple change kept the viewer from tipping over during initialization


Michelle2 Zenovka added a comment - 13/May/08 01:02 AM
Thanks for the update whoops. I'm not always that good at remembering to update my patches. I had solved this in a slightly different way by changing when the init() got called to ensure the media manager and friends were already started.

I've not progressed very far with an independent patch as the llmedia classes are too video orientated and the llaudio classes have all the hooks for detailing with the streaming audio calls. So its an absolute tangle to seperate, so keeping a system where we can have fmod or openal is not easy. Its easy if we ditch fmod completely but then that also negates the need to have it independent of openal in the first place

M2


Tofu Linden added a comment - 13/May/08 02:52 AM
I'll get the llmedia pieces of this applied internally soon, as there's no reason not to.

Tofu Linden added a comment - 21/May/08 10:51 AM
Some feedback:

Instead of using m_streamer->stop(), pause(), play() please use:
m_streamer->addCommand(LLMediaBase::COMMAND_STOP);
m_streamer->addCommand(LLMediaBase::COMMAND_PAUSE);
m_streamer->addCommand(LLMediaBase::COMMAND_START);
(stop, pause, play are all going private RSN, while COMMAND_* are blessed LLMedia API).

Similarly, instead of re-adding methods for isPlaying etc, please use (getStatus() == LLMediaBase::STATUS_STARTED) etc. directly as a LLMedia user - again this is a blessed LLMedia API.

Thanks!


Whoops Babii added a comment - 22/May/08 05:34 AM
I've attached a patch, named openal_patch_1_20_7_llmedia_broken.patch, that inculdes the work of many folk, especially Seg and Michelle who deserve 99% of the credit! It includes the OpenAL audio classes, Wind, and streaming audio. All of which should play nicely in a standard LL build and controlled by defining:

LL_OPENAL - for OpenAL support
LL_OPENAL_WIND - for wind (still needs work)
LL_GSTREAMER_ENABLED - streamed audio

IMPORTANT - the gstreamer changes use Tofu's changes to comply with the LLMedia API. However LLMedia is still not functioning correctly. For example, using:

m_streamer->addCommand(LLMediaBase::COMMAND_STOP)

does not stop the audio. It doesn't even get updated if you follow the "stop" with:

m_streamer->updateCommand();

to force immediate update.


Michelle2 Zenovka added a comment - 22/May/08 05:40 AM
Great Whoops!, glad you are putting the polish on this so it plays nicely with the standard build. If those flags all do what they are suppose to may be we can move this code into the viewer and just enable and build time, wooot! subject to getting llmedia to behave

Whoops Babii added a comment - 22/May/08 05:46 AM
Thanks Michelle!

I just created VWR-7346 on LLMedia. Of course, I neglected to make it a sub-task of this issue Time for more coffee.


Tofu Linden added a comment - 28/May/08 09:24 AM
VWR-7346 commented and resolved. I forgot to add, please don't call updateCommand() - it's really for implementors, not users (I should make this clearer in the headers/protection).

Whoops Babii added a comment - 28/May/08 03:34 PM
Yes! Thanks Tofu! I could have sworn that I tried updateMedia() but this time it works. The openal_patch_1_20_9_works.patch includes the sprinkling of updateMedia() where addCommand() is used.

Tofu Linden added a comment - 28/May/08 03:54 PM
Mind calling updateMedia() from just one place that's destined to get called fairly frequently, rather than from those various sites? LLAudioEngine_OpenAL::idle() looks like the perfect place to me.

The reason is that LLMedia isn't necessarily an asynchronous interface, it's just that the gstreamer implementation 98% is. It's better to poke for an update frequently than just when you assume it's needed (these assumptions may not quite be correct now or in the future).


Whoops Babii added a comment - 29/May/08 07:02 AM
As Tofu has suggested, an updateMedia() should reside in idle(). Patch openal_idle_with_updateMedia.patch does just this. I left the remaining updateMedia() calls as is since we'll likely want the update "pushed" immediately.

I'll also update VMR-2662 with a master patch that includes everything.


Michelle2 Zenovka added a comment - 29/May/08 08:25 AM
Whoops, do you have a contrib agreement on file? if so should we be taking this to the svn sandbox as its getting a bit unwieldy with the number of patches and any little revision needs a new patch attached which is difficult to follow. Should help polish the edges on this one a little. Tofu, does this seem a reasonable idea to you?

Tofu Linden added a comment - 29/May/08 01:37 PM
Sure, working in a sandbox sounds good.

Carlo Waechter added a comment - 30/May/08 12:19 PM
In order to load the libraries correctly on Win32, in llmediaimplgstreamer.cpp

In LLMediaImplGStreamer::startup ( LLMediaManagerData* init_data ) change:

// Get symbols!
if (! grab_gst_syms("libgstreamer-0.10.so.0",
"libgstvideo-0.10.so.0",
"libgstaudio-0.10.so.0") )

to:

// Get symbols!
#if defined(WIN32)
if (! grab_gst_syms("libgstreamer-0.10.dll",
"libgstvideo-0.10.dll",
"libgstaudio-0.10.dll") )
#else
if (! grab_gst_syms("libgstreamer-0.10.so.0",
"libgstvideo-0.10.so.0",
"libgstaudio-0.10.so.0") )
#endif

I have it compiling, linking and running now with VC8.


Michelle2 Zenovka added a comment - 31/May/08 01:16 AM
Carlo, any other changes needed?

Which gstreamer win32 package did you install?

Should these instructions for gstreamer/win32 be placed on a wiki page, this is pretty cool.

Any chance of a success/fail reporting and comparison for various in world streams that you can find?

Thanks


Tofu Linden added a comment - 08/Sep/08 08:26 AM
I've re-implemented this as part of the refactoring going on in VWR-2662 - thanks for demonstrating that this neat hack actually works.