I'm using an IP camera for real time video processing. Using Gstreamer pipeline (with RTSPSRC) for streaming the video.
I want to know how to detect power/network failures while streaming. How to make it recover from such cases?
This is what I'm doing as of now,
int check_connection(void){
char number[5];
int out;
FILE *f = popen("ping -c 1 192.168.0.220 > /dev/null && echo '1' || echo '0'", "r");
while (fgets(number, 5, f) != NULL) {
out = *number;
}
pclose(f);
return out;}
and use this to check its connected or not. return value 49(ASCII of 1) means its connected , 48 (ASCII of 0) means it's not
Anyone with a better answer please post it.