aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediaimplgstreamer.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-05 23:41:16 -0500
committerJacek Antonelli2009-04-06 00:33:07 -0500
commit15296967b6beec8e6f6c5ff4b7e8c274e5d05dca (patch)
treef6c86080ef8a22d431e29fe321d67b5cf347488c /linden/indra/llmedia/llmediaimplgstreamer.cpp
parentAdded LLGstPlayThread class. (diff)
downloadmeta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.zip
meta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.tar.gz
meta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.tar.bz2
meta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.tar.xz
LLMediaImplGStreamer creates new thread for playing.
This keeps the viewer responsive while GStreamer does its thing.
Diffstat (limited to 'linden/indra/llmedia/llmediaimplgstreamer.cpp')
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
index 2ba33a1..c8f793d 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp
@@ -30,10 +30,12 @@
30 * $/LicenseInfo$ 30 * $/LicenseInfo$
31 */ 31 */
32 32
33#include "llmediaimplgstreamer.h"
34
35///#if LL_GSTREAMER_ENABLED 33///#if LL_GSTREAMER_ENABLED
36 34
35#include "linden_common.h"
36
37#include "llmediaimplgstreamer.h"
38
37extern "C" { 39extern "C" {
38#include <gst/gst.h> 40#include <gst/gst.h>
39#include <gst/gstelement.h> 41#include <gst/gstelement.h>
@@ -43,9 +45,8 @@ extern "C" {
43#include "llmediaimplregister.h" 45#include "llmediaimplregister.h"
44 46
45#include "llmediaimplgstreamervidplug.h" 47#include "llmediaimplgstreamervidplug.h"
48#include "llgstplaythread.h"
46 49
47#include "llerror.h"
48#include "linden_common.h"
49 50
50// register this impl with media manager factory 51// register this impl with media manager factory
51static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() ); 52static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() );
@@ -72,7 +73,8 @@ LLMediaImplGStreamer () :
72 mPump ( NULL ), 73 mPump ( NULL ),
73 mPlaybin ( NULL ), 74 mPlaybin ( NULL ),
74 mVideoSink ( NULL ), 75 mVideoSink ( NULL ),
75 mState( GST_STATE_NULL ) 76 mState( GST_STATE_NULL ),
77 mPlayThread ( NULL )
76{ 78{
77 startup( NULL ); // Startup gstreamer if it hasn't been already. 79 startup( NULL ); // Startup gstreamer if it hasn't been already.
78 80
@@ -713,7 +715,20 @@ bool LLMediaImplGStreamer::play()
713 if (!mPlaybin || mState == GST_STATE_NULL) 715 if (!mPlaybin || mState == GST_STATE_NULL)
714 return true; 716 return true;
715 717
716 startPlay(); 718 // Clean up the existing thread, if any.
719 if( mPlayThread != NULL && mPlayThread->isStopped())
720 {
721 delete mPlayThread;
722 mPlayThread = NULL;
723 }
724
725 if( mPlayThread == NULL )
726 {
727 // Make a new thread to start playing. This keeps the viewer
728 // responsive while the stream is resolved and buffered.
729 mPlayThread = new LLGstPlayThread( (LLMediaImplCommon *)this, "GstPlayThread", NULL);
730 mPlayThread->start();
731 }
717 732
718 return true; 733 return true;
719} 734}