From 4102367297550bdf3f56490dec07e722e6ac20c3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 18 Dec 2009 13:21:43 -0800 Subject: minor improvements to gstreamer media plugin's logging. --- .../gstreamer010/llmediaimplgstreamervidplug.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp index 5bb0ef5a99..109e20f179 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp @@ -108,11 +108,10 @@ gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf) slvideo = GST_SLVIDEO(bsink); -#if 0 - fprintf(stderr, "\n\ntransferring a frame of %dx%d <- %p (%d)\n\n", - slvideo->width, slvideo->height, GST_BUFFER_DATA(buf), - slvideo->format); -#endif + DEBUGMSG("\n\ntransferring a frame of %dx%d <- %p (%d)\n\n", + slvideo->width, slvideo->height, GST_BUFFER_DATA(buf), + slvideo->format); + if (GST_BUFFER_DATA(buf)) { // copy frame and frame info into neutral territory @@ -528,7 +527,7 @@ void gst_slvideo_init_class (void) "http://www.secondlife.com/"); #undef PACKAGE ll_gst_plugin_register_static (&gst_plugin_desc); - DEBUGMSG(stderr, "\n\n\nCLASS INIT\n\n\n"); + DEBUGMSG("\n\n\nCLASS INIT\n\n\n"); } #endif // LL_GSTREAMER010_ENABLED -- cgit v1.2.3 From 68b8831fd6d994683082349816755459d75af918 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 18 Dec 2009 13:47:57 -0800 Subject: add PID to gstreamer plugin logging. --- .../media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h index 2244ccc146..799808aa8b 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h @@ -37,10 +37,16 @@ #include +extern "C" { +#include +#include +} + ///////////////////////////////////////////////////////////////////////// // Debug/Info/Warning macros. #define MSGMODULEFOO "(media plugin)" #define STDERRMSG(...) do{\ + fprintf(stderr, " pid:%d: ", (int)getpid());\ fprintf(stderr, MSGMODULEFOO " %s:%d: ", __FUNCTION__, __LINE__);\ fprintf(stderr, __VA_ARGS__);\ fputc('\n',stderr);\ -- cgit v1.2.3 From ceda074b8614e42363a969e32032582caef72278 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 18 Dec 2009 15:10:24 -0800 Subject: gstreamer plugin now does the 'right' thing wrt resizing downwards *and up to its natural size again*. Though I don't like the logic so I'll be rejigging it again next. --- .../gstreamer010/llmediaimplgstreamertriviallogging.h | 2 +- indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h index 799808aa8b..ed8f910f43 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h @@ -53,7 +53,7 @@ extern "C" { }while(0) #define NULLMSG(...) do{}while(0) -#define DEBUGMSG NULLMSG +#define DEBUGMSG STDERRMSG #define INFOMSG STDERRMSG #define WARNMSG STDERRMSG ///////////////////////////////////////////////////////////////////////// diff --git a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index d21ff26f83..daedece1f3 100644 --- a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp @@ -195,6 +195,7 @@ MediaPluginGStreamer010::processGSTEvents(GstBus *bus, } else { + // TODO: grok 'duration' message type DEBUGMSG("Got GST message type: %s", LLGST_MESSAGE_TYPE_NAME (message)); } @@ -841,9 +842,12 @@ MediaPluginGStreamer010::sizeChanged() { // the shared writing space has possibly changed size/location/whatever - // Check to see whether the movie's natural size has updated - if (mNaturalWidth != mPreviousNaturalWidth || - mNaturalHeight != mPreviousNaturalHeight) + // Check to see whether the movie's NATURAL size has been set yet + if ((mNaturalWidth != mPreviousNaturalWidth || + mNaturalHeight != mPreviousNaturalHeight) + && + (1 == mPreviousNaturalWidth && + 1 == mPreviousNaturalHeight)) { mPreviousNaturalWidth = mNaturalWidth; mPreviousNaturalHeight = mNaturalHeight; -- cgit v1.2.3 From 043407238a4162c0d20413338cf6a7088be1f674 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 18 Dec 2009 15:33:52 -0800 Subject: Final tidy-up for DEV-44502 (gstreamer scaling bug) - I *think* this is a bit clearer. Not awesomely so. --- .../llmediaimplgstreamertriviallogging.h | 2 +- .../gstreamer010/media_plugin_gstreamer010.cpp | 63 +++++++++++++--------- 2 files changed, 38 insertions(+), 27 deletions(-) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h index ed8f910f43..799808aa8b 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h @@ -53,7 +53,7 @@ extern "C" { }while(0) #define NULLMSG(...) do{}while(0) -#define DEBUGMSG STDERRMSG +#define DEBUGMSG NULLMSG #define INFOMSG STDERRMSG #define WARNMSG STDERRMSG ///////////////////////////////////////////////////////////////////////// diff --git a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index daedece1f3..8e850ed7ff 100644 --- a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp @@ -115,13 +115,16 @@ private: int mDepth; - // media natural size + // media NATURAL size int mNaturalWidth; int mNaturalHeight; - int mNaturalRowbytes; - // previous media natural size so we can detect changes - int mPreviousNaturalWidth; - int mPreviousNaturalHeight; + // media current size + int mCurrentWidth; + int mCurrentHeight; + int mCurrentRowbytes; + // previous media size so we can detect changes + int mPreviousWidth; + int mPreviousHeight; // desired render size from host int mWidth; int mHeight; @@ -149,7 +152,7 @@ MediaPluginGStreamer010::MediaPluginGStreamer010( void *host_user_data ) : MediaPluginBase(host_send_func, host_user_data), mBusWatchID ( 0 ), - mNaturalRowbytes ( 4 ), + mCurrentRowbytes ( 4 ), mTextureFormatPrimary ( GL_RGBA ), mTextureFormatType ( GL_UNSIGNED_INT_8_8_8_8_REV ), mSeekWanted(false), @@ -430,8 +433,8 @@ MediaPluginGStreamer010::update(int milliseconds) { DEBUGMSG("NEW FRAME READY"); - if (mVideoSink->retained_frame_width != mNaturalWidth || - mVideoSink->retained_frame_height != mNaturalHeight) + if (mVideoSink->retained_frame_width != mCurrentWidth || + mVideoSink->retained_frame_height != mCurrentHeight) // *TODO: also check for change in format { // just resize container, don't consume frame @@ -458,39 +461,39 @@ MediaPluginGStreamer010::update(int milliseconds) GST_OBJECT_UNLOCK(mVideoSink); - mNaturalRowbytes = neww * newd; + mCurrentRowbytes = neww * newd; DEBUGMSG("video container resized to %dx%d", neww, newh); mDepth = newd; - mNaturalWidth = neww; - mNaturalHeight = newh; + mCurrentWidth = neww; + mCurrentHeight = newh; sizeChanged(); return true; } if (mPixels && - mNaturalHeight <= mHeight && - mNaturalWidth <= mWidth && + mCurrentHeight <= mHeight && + mCurrentWidth <= mWidth && !mTextureSegmentName.empty()) { // we're gonna totally consume this frame - reset 'ready' flag mVideoSink->retained_frame_ready = FALSE; int destination_rowbytes = mWidth * mDepth; - for (int row=0; rowretained_frame_data - [mNaturalRowbytes * row], - mNaturalRowbytes); + [mCurrentRowbytes * row], + mCurrentRowbytes); } GST_OBJECT_UNLOCK(mVideoSink); DEBUGMSG("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST"); - setDirty(0,0,mNaturalWidth,mNaturalHeight); + setDirty(0,0,mCurrentWidth,mCurrentHeight); } else { @@ -843,14 +846,20 @@ MediaPluginGStreamer010::sizeChanged() // the shared writing space has possibly changed size/location/whatever // Check to see whether the movie's NATURAL size has been set yet - if ((mNaturalWidth != mPreviousNaturalWidth || - mNaturalHeight != mPreviousNaturalHeight) - && - (1 == mPreviousNaturalWidth && - 1 == mPreviousNaturalHeight)) + if (1 == mNaturalWidth && + 1 == mNaturalHeight) { - mPreviousNaturalWidth = mNaturalWidth; - mPreviousNaturalHeight = mNaturalHeight; + mNaturalWidth = mCurrentWidth; + mNaturalHeight = mCurrentHeight; + DEBUGMSG("Media NATURAL size better detected as %dx%d", + mNaturalWidth, mNaturalHeight); + } + + if (mCurrentWidth != mPreviousWidth || + mCurrentHeight != mPreviousHeight) // if the size has changed then the shm has changed and the app needs telling + { + mPreviousWidth = mCurrentWidth; + mPreviousHeight = mCurrentHeight; LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_request"); message.setValue("name", mTextureSegmentName); @@ -945,10 +954,12 @@ void MediaPluginGStreamer010::receiveMessage(const char *message_string) // lame to have to decide this now, it depends on the movie. Oh well. mDepth = 4; + mCurrentWidth = 1; + mCurrentHeight = 1; + mPreviousWidth = 1; + mPreviousHeight = 1; mNaturalWidth = 1; mNaturalHeight = 1; - mPreviousNaturalWidth = 1; - mPreviousNaturalHeight = 1; mWidth = 1; mHeight = 1; mTextureWidth = 1; -- cgit v1.2.3 From 52c8ffaa49a5e51ed84efd6d755bb96097668464 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 24 Dec 2009 16:53:54 -0800 Subject: Some tidy-ups to the gstreamer media plugin while I try to figure out where the black-frame-on-resize is coming from. --- .../gstreamer010/llmediaimplgstreamertriviallogging.h | 2 +- .../gstreamer010/llmediaimplgstreamervidplug.cpp | 14 +++++++------- .../gstreamer010/llmediaimplgstreamervidplug.h | 2 +- .../gstreamer010/media_plugin_gstreamer010.cpp | 8 +++----- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h index 799808aa8b..ed8f910f43 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h @@ -53,7 +53,7 @@ extern "C" { }while(0) #define NULLMSG(...) do{}while(0) -#define DEBUGMSG NULLMSG +#define DEBUGMSG STDERRMSG #define INFOMSG STDERRMSG #define WARNMSG STDERRMSG ///////////////////////////////////////////////////////////////////////// diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp index 109e20f179..484948bd9f 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp @@ -108,7 +108,7 @@ gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf) slvideo = GST_SLVIDEO(bsink); - DEBUGMSG("\n\ntransferring a frame of %dx%d <- %p (%d)\n\n", + DEBUGMSG("transferring a frame of %dx%d <- %p (%d)", slvideo->width, slvideo->height, GST_BUFFER_DATA(buf), slvideo->format); @@ -336,7 +336,7 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, #define MAXDEPTHHACK 4 GST_OBJECT_LOCK(slvideo); - if (slvideo->resize_forced) + if (slvideo->resize_forced_always) // app is giving us a fixed size to work with { gint slwantwidth, slwantheight; slwantwidth = slvideo->resize_try_width; @@ -385,6 +385,8 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, } } + GST_OBJECT_UNLOCK(slvideo); + if (!made_bufferdata_ptr) // need to fallback to malloc at original size { GST_BUFFER_SIZE(newbuf) = width * height * MAXDEPTHHACK; @@ -393,8 +395,6 @@ gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, llgst_buffer_set_caps (GST_BUFFER_CAST(newbuf), caps); } - GST_OBJECT_UNLOCK(slvideo); - *buf = GST_BUFFER_CAST(newbuf); return GST_FLOW_OK; @@ -458,7 +458,7 @@ gst_slvideo_init (GstSLVideo * filter, filter->retained_frame_format = SLV_PF_UNKNOWN; GstCaps *caps = llgst_caps_from_string (SLV_ALLCAPS); llgst_caps_replace (&filter->caps, caps); - filter->resize_forced = false; + filter->resize_forced_always = false; filter->resize_try_width = -1; filter->resize_try_height = -1; GST_OBJECT_UNLOCK(filter); @@ -499,7 +499,7 @@ gst_slvideo_get_property (GObject * object, guint prop_id, static gboolean plugin_init (GstPlugin * plugin) { - DEBUGMSG("\n\n\nPLUGIN INIT\n\n\n"); + DEBUGMSG("PLUGIN INIT"); GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin", 0, (gchar*)"Second Life Video Sink"); @@ -527,7 +527,7 @@ void gst_slvideo_init_class (void) "http://www.secondlife.com/"); #undef PACKAGE ll_gst_plugin_register_static (&gst_plugin_desc); - DEBUGMSG("\n\n\nCLASS INIT\n\n\n"); + DEBUGMSG("CLASS INIT"); } #endif // LL_GSTREAMER010_ENABLED diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h index 208523e8d0..8f1cf84978 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h @@ -90,7 +90,7 @@ struct _GstSLVideo int retained_frame_width, retained_frame_height; SLVPixelFormat retained_frame_format; // sticky resize info - bool resize_forced; + bool resize_forced_always; int resize_try_width; int resize_try_height; }; diff --git a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index 8e850ed7ff..c1389a7a4d 100644 --- a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp @@ -477,9 +477,8 @@ MediaPluginGStreamer010::update(int milliseconds) mCurrentWidth <= mWidth && !mTextureSegmentName.empty()) { - // we're gonna totally consume this frame - reset 'ready' flag - mVideoSink->retained_frame_ready = FALSE; + mVideoSink->retained_frame_ready = FALSE; int destination_rowbytes = mWidth * mDepth; for (int row=0; rowresize_forced = true; + mVideoSink->resize_forced_always = true; mVideoSink->resize_try_width = texture_width; mVideoSink->resize_try_height = texture_height; GST_OBJECT_UNLOCK(mVideoSink); -- cgit v1.2.3 From 4070f6636e06b698f8b46d3e8009305eb3594a13 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 24 Dec 2009 16:57:53 -0800 Subject: more minor cleanup to the gstreamer plugin. --- indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp index c1389a7a4d..26173314a7 100644 --- a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp @@ -105,7 +105,7 @@ private: void mouseUp( int x, int y ); void mouseMove( int x, int y ); - bool sizeChanged(); + void sizeChanged(); static bool mDoneInit; @@ -839,7 +839,7 @@ MediaPluginGStreamer010::startup() } -bool +void MediaPluginGStreamer010::sizeChanged() { // the shared writing space has possibly changed size/location/whatever @@ -854,8 +854,9 @@ MediaPluginGStreamer010::sizeChanged() mNaturalWidth, mNaturalHeight); } + // if the size has changed then the shm has changed and the app needs telling if (mCurrentWidth != mPreviousWidth || - mCurrentHeight != mPreviousHeight) // if the size has changed then the shm has changed and the app needs telling + mCurrentHeight != mPreviousHeight) { mPreviousWidth = mCurrentWidth; mPreviousHeight = mCurrentHeight; @@ -867,8 +868,6 @@ MediaPluginGStreamer010::sizeChanged() DEBUGMSG("<--- Sending size change request to application with name: '%s' - natural size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight); sendMessage(message); } - - return true; } -- cgit v1.2.3 From 005688984d3d01609a6649799d82e22339ef91b5 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 24 Dec 2009 17:18:39 -0800 Subject: turn off verbose logging on gstreamer media plugin. --- indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/media_plugins/gstreamer010') diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h index ed8f910f43..799808aa8b 100644 --- a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h +++ b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h @@ -53,7 +53,7 @@ extern "C" { }while(0) #define NULLMSG(...) do{}while(0) -#define DEBUGMSG STDERRMSG +#define DEBUGMSG NULLMSG #define INFOMSG STDERRMSG #define WARNMSG STDERRMSG ///////////////////////////////////////////////////////////////////////// -- cgit v1.2.3