imxv4l2videosrc pausing issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imxv4l2videosrc pausing issue

1,812 Views
DanJozwiak
Contributor II

I am running on a Nitrogen6x with the OV5642 camera and using Freescale BSP 1.8. I have a Qt application (Qt 5.5.1) running a GStreamer pipeline (GStreamer 1.6.1) that streams video from the camera to the display and, at the same time, captures the frames to a file.

The pipeline is as follows:

imxv4l2videosrc capture-mode=0 ! tee name=t ! queue ! imxeglvivsink window-width=640 window-height=480 window-x-coord=320 window-y-coord=160 async=false t. ! queue ! videoconvert ! jpegenc ! multifilesink location=/tmp/frame.jpg max-files=1 async=false

The UI has a button that allows a user to capture a snapshot of the video. In order to do this I pause the pipeline, copy the /tmp/frame.jpg off to a safe place and then resume the pipeline. Then I convert the saved frame to a pixmap for display to the user.

The problem occurs with the pause. At the time of the pause, about 50% of the time, it hangs until a dequeue timeout occurs (about 10 seconds) and I get the following messages (used GST_DEBUG=4 and I've annotated the log in bold)

0:00:10.408627334   432   0xeaac00 INFO              GST_STATES gstbin.c:2243:gst_bin_element_set_state:<imxv4l2videosrc0> current PLAYING pending VOID_PENDING,

desired next PAUSED <---- all other pipeline elements are in a paused state at this point but this doesn't show changed to paused successfully

Delay occurs here for about 10 seconds followed by:

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

0:00:20.088298669   432   0xffa460 ERROR      imxv4l2bufferpool v4l2_buffer_pool.c:238:gst_imx_v4l2_buffer_pool_acquire_buffer:<imxv4l2bufferpool0> VIDIOC_DQBUF failed: Timer expired

0:00:20.088424002   432   0xffa460 INFO                 basesrc gstbasesrc.c:2734:gst_base_src_loop:<imxv4l2videosrc0> pausing after gst_base_src_get_range() = error

0:00:20.088561669   432   0xffa460 WARN                 basesrc gstbasesrc.c:2943:gst_base_src_loop:<imxv4l2videosrc0> error: Internal data flow error.

0:00:20.088632335   432   0xffa460 WARN                 basesrc gstbasesrc.c:2943:gst_base_src_loop:<imxv4l2videosrc0> error: streaming task paused, reason error (-5)

0:00:20.088743669   432   0xffa460 INFO        GST_ERROR_SYSTEM gstelement.c:1837:gst_element_message_full:<imxv4l2videosrc0> posting message: Internal data flow error.

0:00:20.088918669   432   0xffa460 INFO        GST_ERROR_SYSTEM gstelement.c:1860:gst_element_message_full:<imxv4l2videosrc0> posted error message: Internal data flow error.

0:00:20.089066669   432   0xffa460 INFO                    task gsttask.c:315:gst_task_func:<imxv4l2videosrc0:src> Task going to paused

0:00:20.089162002   432   0xeaac00 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<imxv4l2videosrc0> completed state change to PAUSED <---- now it finally got to the paused state

0:00:20.089228002   432   0xeaac00 INFO              GST_STATES gstelement.c:2235:_priv_gst_element_state_changed:<imxv4l2videosrc0> notifying about state-changed PLAYING to PAUSED (VOID_PENDING pending)

After this the video streaming stops and I see the following:

0:00:20.792978335   432   0xffa460 INFO                    task gsttask.c:317:gst_task_func:<imxv4l2videosrc0:src> Task resume from paused

0:00:20.793509669   432   0xffa460 INFO                 basesrc gstbasesrc.c:2851:gst_base_src_loop:<imxv4l2videosrc0> pausing after gst_pad_push() = eos

0:00:20.793703669   432   0xffa460 INFO                    task gsttask.c:315:gst_task_func:<imxv4l2videosrc0:src> Task going to paused

0:00:20.793871002   432   0xeaac00 INFO              GST_STATES gstelement.c:2330:gst_element_continue_state:<imxv4l2videosrc0> completed state change to PLAYING <---- it looks like it should be playing except the previous message says that it is going to paused. Note that all other elements have gone back to playing state

Note that the setting of the 'async=false' property in both the imxeglvivsink and the multifilesink are there due to posts that I found of people having trouble pausing a pipeline and the recommended solution was to set that property to false. However, the imxv4l2videosrc has no such property.

It seems that the imxv4l2videosrc element may actually be paused but stuck (since we never see the message indicating that it successfully changed to the paused state) but the rest of the plugin doesn't know about it, thus the dequeue timeout. I have not found any posts related to this issue so I was wondering if there's anyone with a working knowledge of this plugin that would have an idea why this would fail some of the time. The only alternative seems to be to destroy the pipeline, save the frame and then start a new pipeline from scratch but that's not a good solution due to the delay the user experiences.

0 Kudos
1 Reply

827 Views
chrisroed
Contributor IV

I have a similar observation streaming to an RTMP server.  I had to insert a 'queue' element into the imxv4l2videosrc pipeline in order to get the audio and video to sync correctly, but now that the queue is there, the video source never gets into paused mode.

gst-launch-1.0 \

  flvmux streamable=true name=muxer !  \

       filesink location=/root/test.mp4 \

  imxv4l2videosrc ! queue ! \

       imxvpuenc_h264 quant-param=31 ! h264parse !  \

       muxer. \

  alsasrc ! audio/x-raw,channels=1 ! \

       audioconvert !  \

       faac rate-control=2 ! \

       muxer.

When I try to pause the pipeline I end up with

0:00:09.638704132  1635   0xbc5c00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<imxv4l2videosrc0> current PLAYING pending VOID_PENDING, desired next PAUSED

but it never actually pauses.  Did you have any luck fixing your issue?

0 Kudos