Skip to content

Commit 4310b04

Browse files
committed
Enable liveview on Raspberry Pi
1 parent 961c3ae commit 4310b04

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

examples/camera-app/linux/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,10 @@ git config --global --add safe.directory /var/connectedhomeip/third_party/pigwee
117117
# SCP command to transfer the file
118118
scp ./out/linux-arm64-camera-clang/chip-camera-app ubuntu@<RASPBERRY_PI_IP_ADDRESS>:/home/ubuntu
119119
```
120+
121+
5. Add your user to the video group
122+
123+
```
124+
sudo usermod -aG video $USER
125+
newgrp video
126+
```

examples/camera-app/linux/src/camera-device.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,44 @@ CameraError CameraDevice::StartVideoStream(const VideoStreamStruct & allocatedSt
849849
GstStateChangeReturn result = gst_element_set_state(videoPipeline, GST_STATE_PLAYING);
850850
if (result == GST_STATE_CHANGE_FAILURE)
851851
{
852+
// Get error message from GStreamer bus
853+
GstBus * bus = gst_element_get_bus(videoPipeline);
854+
if (bus)
855+
{
856+
GstMessage * msg = gst_bus_pop_filtered(bus, (GstMessageType) (GST_MESSAGE_ERROR | GST_MESSAGE_WARNING));
857+
if (msg)
858+
{
859+
GError * err = nullptr;
860+
gchar * debug_info = nullptr;
861+
862+
if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR)
863+
{
864+
gst_message_parse_error(msg, &err, &debug_info);
865+
ChipLogError(Camera, "GStreamer Error: %s", err ? err->message : "unknown");
866+
if (debug_info)
867+
{
868+
ChipLogError(Camera, "Debug info: %s", debug_info);
869+
}
870+
}
871+
else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_WARNING)
872+
{
873+
gst_message_parse_warning(msg, &err, &debug_info);
874+
ChipLogError(Camera, "GStreamer Warning: %s", err ? err->message : "unknown");
875+
if (debug_info)
876+
{
877+
ChipLogError(Camera, "Debug info: %s", debug_info);
878+
}
879+
}
880+
881+
if (err)
882+
g_error_free(err);
883+
if (debug_info)
884+
g_free(debug_info);
885+
gst_message_unref(msg);
886+
}
887+
gst_object_unref(bus);
888+
}
889+
852890
ChipLogError(Camera, "Failed to start video pipeline.");
853891
gst_object_unref(videoPipeline);
854892
it->videoContext = nullptr;

examples/camera-controller/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ sudo apt install \
4343
gstreamer1.0-plugins-bad \
4444
gstreamer1.0-libav \
4545
libgstreamer1.0-dev \
46+
libavformat60 \
4647
libgstreamer-plugins-base1.0-dev
4748
```
4849

0 commit comments

Comments
 (0)