RidgeRun / gstd-1.x

GStreamer Daemon is a GStreamer framework for controlling audio and video streaming using TCP messages. This version is based on GStreamer 1.x
https://developer.ridgerun.com/wiki/index.php?title=Gstd-1.0
GNU Lesser General Public License v2.1
172 stars 55 forks source link

Inconsistent response json structure for element_get #313

Open tinChe- opened 2 years ago

tinChe- commented 2 years ago

I’m receiving inconsistent JSON structure for responses of javascript function element_get(pipe_name, element, prop) and same using gstd-client tool. The data that should be in the param is in value for some requests. Below is an example (just the response part of JSON).

Correct response:

{
  "code" : 0,
  "description" : "Success",
  "response" : {
    "name" : "force-aspect-ratio",
    "value" : "true",
    "param" : {
        "description" : "When enabled, the pixel aspect ratio will be enforced",
        "type" : "gboolean",
        "access" : "((GstdParamFlags) READ | 226)"
    }
}
}

Wrong response

{
  "code" : 0,
  "description" : "Success",
  "response" : {
    "name" : "pixel-aspect-ratio",
    "value" : {
        "description" : "Overwrite the pixel aspect ratio of the device",
        "type" : "gchararray",
        "access" : "((GstdParamFlags) READ | 226)"
    }
}
}

In the wrong response, the data that should be inside "param" field is in "value" and there is no information of "value".

The GstD outputs following messages when the wrong response is generated:

** (gstd:11338): CRITICAL **: 12:41:54.123: gstd_json_set_string_value: assertion 'value' failed

(gstd:11338): Json-CRITICAL **: 12:41:54.123: json_builder_set_member_name: assertion 'json_builder_current_mode (builder) == JSON_BUILDER_MODE_OBJECT' failed

I'm using NVIDIA Jetson Nano with original SD card (Ubuntu) GstD version 0.15.0

To reproduce:

gstd-client pipeline_create camera_stream v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=60/1,format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2h264enc bitrate=16000000 insert-sps-pps=true idrinterval=30 enable-lossless=true ! video/x-h264, mapping=/stream1 ! rtspsink service=12345
gstd-client element_get camera_stream v4l2src0 pixel-aspect-ratio
gstd-client element_get camera_stream v4l2src0 force-aspect-ratio
lleon95 commented 2 years ago

Hi @tinChe-

Thanks for your detailed report. Could you tell us which branch you are using?

Currently, I am integrating a change to fix a similar issue: https://github.com/RidgeRun/gstd-1.x/pull/312

I think with the PR comments, this may be fixed. I will tell you as soon as I get it

BR, Leon

tinChe- commented 2 years ago

@lleon95 Actually, I have tested master and develop branches. It behaves the same on both.

lleon95 commented 2 years ago

Can you test this fix?

feature/fix-write-only-property-messages

tinChe- commented 2 years ago

@lleon95 I can confirm that using feature/fix-write-only-property-messages branch resolve this issue

tinChe- commented 2 years ago

This is probably unrelated but using the same pipeline and reading the element v4l2src0 extra-controls outputs the error on GstD: (gstd:13182): GStreamer-CRITICAL **: 09:06:58.312: gst_structure_to_string: assertion 'structure != NULL' failed

To reproduce:

gstd-client pipeline_create camera_stream v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=60/1,format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2h264enc bitrate=16000000 insert-sps-pps=true idrinterval=30 enable-lossless=true ! video/x-h264, mapping=/stream1 ! rtspsink service=12345
gstd-client element_get camera_stream v4l2src0 extra-controls
lleon95 commented 2 years ago

This is probably unrelated but using the same pipeline and reading the element v4l2src0 extra-controls outputs the error on GstD: (gstd:13182): GStreamer-CRITICAL **: 09:06:58.312: gst_structure_to_string: assertion 'structure != NULL' failed

To reproduce:

gstd-client pipeline_create camera_stream v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=60/1,format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2h264enc bitrate=16000000 insert-sps-pps=true idrinterval=30 enable-lossless=true ! video/x-h264, mapping=/stream1 ! rtspsink service=12345
gstd-client element_get camera_stream v4l2src0 extra-controls

Is this the only message that appears? It happens when the property returns an empty structure.

tinChe- commented 2 years ago

Yes, this is the only message output from the gstd, and it is outputted every time the element is queried. I get the same behavior when querying extra-controls from other elements for example nvv4l2decoder0

Another thing that I noticed is when querying last-sample from example gstinterpipe or rtspsink I get 4 lines

(gstd:13704): GStreamer-CRITICAL **: 08:07:52.407: gst_sample_get_buffer: assertion 'GST_IS_SAMPLE (sample)' failed
(gstd:13704): GStreamer-CRITICAL **: 08:07:52.407: gst_sample_get_caps: assertion 'GST_IS_SAMPLE (sample)' failed
(gstd:13704): GStreamer-CRITICAL **: 08:07:52.407: gst_sample_get_segment: assertion 'GST_IS_SAMPLE (sample)' failed
(gstd:13704): GStreamer-CRITICAL **: 08:07:52.407: gst_sample_get_info: assertion 'GST_IS_SAMPLE (sample)' failed

If I query nvv4l2decoder0 device-name I get one line that opens something

Opening in BLOCKING MODE