Skip to content

Commit

Permalink
Fix some issues with shmsrc pipeline and video dimensions (bug #29)
Browse files Browse the repository at this point in the history
Shmsrc seems to work with a gstreamer 1.4 build, but not with distro gstreamer
(segfault due to missing fix https://bugzilla.gnome.org/show_bug.cgi?id=731093)
Reader / writer of live source need to be using same gstreamer build, otherwise
some pipeline problems appear in deserializing and caps detection.

Playback of the first shape mapped with the live source doesn't seem to work (?),
so this bug stiil needs investigation.
  • Loading branch information
vliaskov committed Oct 18, 2014
1 parent 8e9f7dd commit 835165c
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions MediaImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ bool MediaImpl::_videoPull()
// Pull current frame buffer.
GstBuffer *buffer = gst_sample_get_buffer(sample);

// for live sources, video dimensions have not been set, because
// gstPadAddedCallback is never called. Fix dimensions from first sample /
// caps we receive
if (_isSharedMemorySource && ( _padHandlerData.width == -1 ||
_padHandlerData.height == -1)) {
GstCaps *caps = gst_sample_get_caps(sample);
GstStructure *structure;
structure = gst_caps_get_structure(caps, 0);
gst_structure_get_int(structure, "width", &_padHandlerData.width);
gst_structure_get_int(structure, "height", &_padHandlerData.height);
// g_print("Size is %u x %u\n", _padHandlerData.width, _padHandlerData.height);
}

GstMapInfo map;
if (gst_buffer_map(buffer, &map, GST_MAP_READ))
{
Expand Down Expand Up @@ -347,14 +360,14 @@ bool MediaImpl::loadMovie(QString filename)
// Build the pipeline. Note that we are NOT linking the source at this
// point. We will do it later.
gst_bin_add_many (GST_BIN (_pipeline),
_uridecodebin0, _queue0, _videoconvert0,
videoscale0, capsfilter0, _appsink0, NULL);
_isSharedMemorySource ? _shmsrc0 : _uridecodebin0, _queue0,
_videoconvert0, videoscale0, capsfilter0, _appsink0, NULL);

// special case for shmsrc
if (_isSharedMemorySource)
{
gst_bin_add (GST_BIN(_pipeline), _gdpdepay0);
if (! gst_element_link_many (_uridecodebin0, _gdpdepay0, _queue0, NULL))
if (! gst_element_link_many (_shmsrc0, _gdpdepay0, _queue0, NULL))
{
g_printerr ("Could not link shmsrc, deserializer and video queue.\n");
}
Expand Down Expand Up @@ -410,8 +423,8 @@ bool MediaImpl::loadMovie(QString filename)
else
{
//qDebug() << "LIVE mode" << uri;
g_object_set (_uridecodebin0, "socket-path", uri, NULL);
g_object_set (_uridecodebin0, "is-live", TRUE, NULL);
g_object_set (_shmsrc0, "socket-path", uri, NULL);
g_object_set (_shmsrc0, "is-live", TRUE, NULL);
_padHandlerData.videoIsConnected = true;
}

Expand Down Expand Up @@ -448,7 +461,6 @@ bool MediaImpl::loadMovie(QString filename)
{
return false;
}

qDebug() << "Pipeline started.";

//_movieReady = true;
Expand Down

0 comments on commit 835165c

Please sign in to comment.