Skip to content

Commit

Permalink
removed a segfault caused by using the wrong threadhandle for pthread…
Browse files Browse the repository at this point in the history
…_kill()
  • Loading branch information
hostbuster committed Oct 29, 2011
1 parent 77f154d commit b5d579f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
21 changes: 11 additions & 10 deletions linescan.c
Expand Up @@ -1531,8 +1531,8 @@ on_bus_call (GstBus *bus, GstMessage *msg, gpointer data) {
case GST_MESSAGE_EOS:
g_print ("\nGStreamer: (bus) End of stream\n");
g_main_loop_quit(loop);
pthread_kill(view_thread_id,SIGINT);
exit(1);
pthread_kill(view_thread,SIGINT);
exit(EXIT_SUCCESS);
break;

case GST_MESSAGE_ERROR: {
Expand All @@ -1549,7 +1549,7 @@ on_bus_call (GstBus *bus, GstMessage *msg, gpointer data) {
GST_STATE_READY) == GST_STATE_CHANGE_FAILURE) {
printf("GStreamer: unable to set pipeline to paused\n");
gst_object_unref(pipeline);
exit(0);
exit(EXIT_FAILURE);
}

//g_main_loop_quit (loop);
Expand Down Expand Up @@ -1688,23 +1688,24 @@ gint main (gint argc, gchar *argv[]) {
if (flag_calib) {
calibration_loadimages();
}


int result;
// init viewer thread
if (flag_display) {
view_thread_id = pthread_mutex_init(&frame_mutex, NULL);
if (view_thread_id != 0) {
result = pthread_mutex_init(&frame_mutex, NULL);
if (result != 0) {
perror("Mutex initialisation failed");
exit(EXIT_FAILURE);
}

view_thread_id = pthread_mutex_init(&last_full_frame_mutex, NULL);
if (view_thread_id != 0) {
result = pthread_mutex_init(&last_full_frame_mutex, NULL);
if (result != 0) {
perror("Mutex initialisation failed");
exit(EXIT_FAILURE);
}

view_thread_id = pthread_create(&view_thread, NULL, gl_view_thread_func, NULL);
if (view_thread_id != 0) {
result = pthread_create(&view_thread, NULL, gl_view_thread_func, NULL);
if (result != 0) {
perror("Thread creation failed");
exit(EXIT_FAILURE);
}
Expand Down
3 changes: 2 additions & 1 deletion linescan.conf
Expand Up @@ -10,5 +10,6 @@ jp4pipeline rtspsrc location=rtsp://192.168.0.9:554 latency=100 protocols=0x0000
gstpipeline rtspsrc location=rtsp://192.168.0.9:554 latency=100 protocols=0x00000001 ! rtpjpegdepay! jpegdec ! ffmpegcolorspace
#gstpipeline rtspsrc location=rtsp://192.168.0.10:554 latency=100 protocols=0x00000001 ! rtpjpegdepay! jpegdec ! queue ! ffmpegcolorspace
#gstpipeline videotestsrc ! videoflip method=clockwise ! ffmpegcolorspace
gstpipeline filesrc location=/home/mash/Movies/x.avi ! decodebin ! videoflip method=clockwise ! ffmpegcolorspace
#gstpipeline filesrc location=/home/mash/Movies/x.avi ! decodebin ! videoflip method=clockwise ! ffmpegcolorspace
gstpipeline filesrc location=/media/TB_DAT/lazy_noon/Video/still_vor.mpg ! decodebin ! videoflip method=clockwise ! ffmpegcolorspace
#gstpipeline dv1394src ! dvdemux ! dvdec

0 comments on commit b5d579f

Please sign in to comment.