Skip to content

Commit da0dd1f

Browse files
author
hu
committed
Fix USB webcam support for gstreamer sample app
1 parent ba2a1d5 commit da0dd1f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,18 @@ $ sudo reboot
245245

246246
* Raspberry PI seg fauls after some time running on libx264.so. Rebuilding the libx264.so library and re-linking the demo application fixes the issue.
247247

248+
249+
* If an USB webcam is used with a Raspberry PI and the webcam does not support 720p. The following error can occur. Reduce the resolution to 480p at line 336 and 356 should fix the problem. (change the number from 1280 and 720 to 640 and 480)
250+
251+
Error received from element source: Internal data stream error.
252+
Debugging information: gstbasesrc.c(2939): gst_base_src_loop (): /GstPipeline:test-pipeline/GstV4l2Src:source:
253+
streaming stopped, reason not-negotiated (-4)
254+
248255
## Release Notes
256+
### Release 1.1.1 (December 2017)
257+
* Fix USB webcam support
258+
* Known issues:
259+
* If USB webcam doesn't support 720p, then gstreamer negotiation will fail. Trying lower resolution as mentioned in Troubleshooting may fix this issue.
249260
### Release 1.1.0 (December 2017)
250261
* Addition of a received application ACK notification callback
251262
* Lifecycle management improvements

kinesis-video-gst-demo/kinesis_video_gstreamer_sample_app.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const unsigned char cpd[] = { 0x01, 0x42, 0x00, 0x20, 0xff, 0xe1, 0x00, 0x23, 0x
135135
unique_ptr<Credentials> credentials_;
136136

137137
typedef struct _CustomData {
138-
GstElement *pipeline, *source, *source_filter, *encoder, *filter, *appsink;
138+
GstElement *pipeline, *source, *source_filter, *encoder, *filter, *appsink, *video_convert;
139139
GstBus *bus;
140140
GMainLoop *main_loop;
141141
unique_ptr<KinesisVideoProducer> kinesis_video_producer;
@@ -305,6 +305,7 @@ int gstreamer_init(int argc, char* argv[]) {
305305
data.source_filter = gst_element_factory_make("capsfilter", "source_filter");
306306
data.filter = gst_element_factory_make("capsfilter", "encoder_filter");
307307
data.appsink = gst_element_factory_make("appsink", "appsink");
308+
data.video_convert = gst_element_factory_make("videoconvert", "video_convert");
308309

309310
// Attempt to create vtenc encoder
310311
data.encoder = gst_element_factory_make("vtenc_h264_hw", "encoder");
@@ -321,7 +322,7 @@ int gstreamer_init(int argc, char* argv[]) {
321322
/* create an empty pipeline */
322323
data.pipeline = gst_pipeline_new("test-pipeline");
323324

324-
if (!data.pipeline || !data.source || !data.source_filter || !data.encoder || !data.filter || !data.appsink) {
325+
if (!data.pipeline || !data.source || !data.source_filter || !data.encoder || !data.filter || !data.appsink || !data.video_convert) {
325326
g_printerr("Not all elements could be created.\n");
326327
return 1;
327328
}
@@ -365,9 +366,9 @@ int gstreamer_init(int argc, char* argv[]) {
365366
g_signal_connect(data.appsink, "new-sample", G_CALLBACK(on_new_sample), &data);
366367

367368
/* build the pipeline */
368-
gst_bin_add_many(GST_BIN (data.pipeline), data.source, data.source_filter, data.encoder, data.filter,
369+
gst_bin_add_many(GST_BIN (data.pipeline), data.source, data.source_filter, data.video_convert, data.encoder, data.filter,
369370
data.appsink, NULL);
370-
if (gst_element_link_many(data.source, data.source_filter, data.encoder, data.filter, data.appsink, NULL) != TRUE) {
371+
if (gst_element_link_many(data.source, data.source_filter, data.video_convert, data.encoder, data.filter, data.appsink, NULL) != TRUE) {
371372
g_printerr("Elements could not be linked.\n");
372373
gst_object_unref(data.pipeline);
373374
return 1;

0 commit comments

Comments
 (0)