teltek / Galicaster

The Galicaster Project is an open initiative to provide flexible, state-of-the-art solutions for recording educational multimedia contents like lectures and conferences
galicaster.teltek.es
Other
35 stars 31 forks source link

Profile error after too many short consecutives recordings #298

Open silviabf opened 8 years ago

silviabf commented 8 years ago

Steps:

Problem: After 5 or 6 recordings there is a profile error when you stop the recording. In the log you can see the next info:

galicaster  2016-06-14 11:31:43,963 DEBUG   recorder    recorder preview
galicaster  2016-06-14 11:31:44,032 ERROR   recorder    gst-resource-error-quark: Device '/dev/webcam' is busy (4) (gstv4l2object.c(3450): gst_v4l2_object_set_format_full (): /GstPipeline:galicaster_recorder/galicaster+recorder+bins+v4l2+GCv4l2:galicaster+recorder+bins+v4l2+gcv4l2-12/GstBin:bin18/GstV4l2Src:gc-v4l2-src:
Call to S_FMT failed for YV12 @ 1280x720: Device or resource busy)
galicaster  2016-06-14 11:31:44,069 ERROR   service Handle error (gst-resource-error-quark: Device '/dev/webcam' is busy (4) (gstv4l2object.c(3450): gst_v4l2_object_set_format_full (): /GstPipeline:galicaster_recorder/galicaster+recorder+bins+v4l2+GCv4l2:galicaster+recorder+bins+v4l2+gcv4l2-12/GstBin:bin18/GstV4l2Src:gc-v4l2-src:
Call to S_FMT failed for YV12 @ 1280x720: Device or resource busy))
galicaster  2016-06-14 11:31:53,339 INFO    scheduler   Set status unknown to server

And in the console:

** (run_galicaster.py:28834): CRITICAL **: gst_v4l2_buffer_pool_process: assertion 'gst_buffer_pool_is_active (bpool)' failed
libv4l2: error setting pixformat: Device or resource busy

@smarquard, you reported this message in issue #227. Is this message shown in a similar situation (very close recordings or too many consecutive recordings)?. Thank you in advance.

hcaloto commented 8 years ago

Let's check if this error persists after these changes: https://github.com/teltek/Galicaster/commit/089a3a4ca2ab1ceba5e2122280723a87bdc91dc0 and https://github.com/teltek/Galicaster/commit/85db8131fc7af5b004eafbd788269d0a75098f8c

silviabf commented 8 years ago

This bug continues happening.

silviabf commented 8 years ago

This bug happens more frecuently if you use io-mode parameter in the profile.

rubenrua commented 8 years ago

To test execute the next snippet test.py:

import time
from galicaster.core import context
r = context.get_recorder()
r.preview()
time.sleep(1)
while True:
    r.record()
    time.sleep(1)
    r.stop()
    time.sleep(1)

with:

GST_DEBUG=*v4l2*:6  strace -o /tmp/strace.log -P /dev/video0 python test.py 2> /tmp/gst.log

Getting the error: libv4l2: error setting pixformat: Device or resource busy

rubenrua commented 8 years ago

We need to test it with GStramer 1.8.2 (ubuntu xenial-updates), you can check changes in https://github.com/GStreamer/gst-plugins-good/commits/master/sys/v4l2/gstv4l2src.c

dpeite commented 8 years ago

With the next script there is no error:

import gi
gi.require_version('Gst','1.0')
from gi.repository import Gst
Gst.init(None)
print Gst.version()

while True:
        # Build the pipeline                                                                                                                                                                                 
        pipeline = Gst.parse_launch(
                "v4l2src device=/dev/video0 num-buffers=100 ! video/x-raw,framerate=24/1,width=1280,height=720 ! xvimagesink")
        # Start playing                                                                                                                                                                                      
        pipeline.set_state(Gst.State.PLAYING)

        # Wait until error or EOS                                                                                                                                                                            
        bus = pipeline.get_bus()
        msg = bus.timed_pop_filtered(
                Gst.CLOCK_TIME_NONE, Gst.MessageType.ERROR | Gst.MessageType.EOS)
        # Free resources                                                                                                                                                                                     
        pipeline.set_state(Gst.State.NULL)
dpeite commented 8 years ago

test_ok_raw_ynb.py.txt use num-buffers in pipeline and works fine test_ko_raw_nnb.py.txt not use num-buffers in pipeline and getting the error: libv4l2: error setting pixformat: Device or resource busy test_xx_raw_nnb_2.py.txt same test with a short pipeline, fail again

Alfro commented 8 years ago

We are working with the GStreamer project to solve this issue: https://bugzilla.gnome.org/show_bug.cgi?id=772521

Alfro commented 7 years ago

I failed to update this issue here, but the GStreamer devs solved it in the 1.8 branch of the plugins-good project. The change was included in the 1.10.3 version, so it should be solved from there onwards.

Alfro commented 7 years ago

We patched the gstreamer package (gstreamer1.0-plugins-good) for their 1.8 version, so either upgrading that package from our repo or us fixing #531 and upgrading to 1.10 should solve this issue.