0

My goal is to restart the Argus Camera API or Gstreamer pipeline restarting the system. This is because sometimes the C++ app crash and will not restart. The only known solution now is to restart the system.

My expected result is that I can restart the C++ app without the need to restart the system.

My actual result is that I need to restart the system.

(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 266)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 340)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 357)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 368)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 145)
(Argus) Error EndOfFile:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:791 Failed to create OutputStream
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)
nvbuf_utils: Could not get EGL display connection
GST_ARGUS: Creating output stream
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:751 Failed to create CaptureSession
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
Start grabbing
Press q to terminate
Press v for verbose
Press p to predict
ERROR! blank frame grabbed
(Argus) Error InvalidState: Receive thread is not running cannot send. (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 96)
(Argus) Error InvalidState:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 91)

How to open camera.

JetsonCamera::JetsonCamera(const std::string sensorID,
                           const std::string captureWidth,
                           const std::string captureHeight,
                           const std::string frameRate,
                           const std::string displayWidth,
                           const std::string displayHeight)
    : cap_(buildGStreamerPipeline(sensorID,
                                  captureWidth,
                                  captureHeight,
                                  frameRate,
                                  displayWidth,
                                  displayHeight),
           cv::CAP_GSTREAMER)
{
}

std::string JetsonCamera::buildGStreamerPipeline(
    const std::string sensorID,
    const std::string captureWidth,
    const std::string captureHeight,
    const std::string frameRate,
    const std::string displayWidth,
    const std::string displayHeight)
{
    std::stringstream pipeline;
    pipeline << "nvarguscamerasrc sensor-id=" << sensorID << " ! "
             << "video/x-raw(memory:NVMM),width=(int)" << captureWidth << ",height=(int)" << captureHeight << ",format=(string)NV12,framerate=(fraction)" << frameRate << "/1 ! "
             << "nvvidconv flip-method=0 ! "
             << "video/x-raw,width=(int)" << displayWidth << ",height=(int)" << displayHeight << ",format=(string)BGRx ! "
             << "videoconvert ! "
             << "video/x-raw,format=(string)BGR ! "
             << "appsink";
    return pipeline.str();
}
Jason Rich Darmawan
  • 1,607
  • 3
  • 14
  • 31

1 Answers1

0

You would just restart nvargus-daemon service:

sudo systemctl restart nvargus-daemon.service

Note that it may also help to set appsink property drop to true, it may better behave when opencv capture terminates:

<< "appsink drop=1";
SeB
  • 1,159
  • 6
  • 17
  • It does not work. `nvbuf_utils: dmabuf_fd -1 mapped entry NOT found nvbuf_utils: Can not get HW buffer from FD... Exiting... CONSUMER: ERROR OCCURRED [ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module nvarguscamerasrc0 reported: CANCELLED GST_ARGUS: Cleaning up` – Jason Rich Darmawan Mar 01 '23 at 04:57
  • This seems like a different issue. You may tell how you're accessing the camera from opencv. – SeB Mar 01 '23 at 14:43
  • kindly check the main post, I have edited it. – Jason Rich Darmawan Mar 01 '23 at 15:16