尝试释放资源时出现gstreamer gst-CRITICAL错误

时间:2019-03-04 14:50:32

标签: gstreamer-1.0

我编写了一个使用gstreamer-1.0播放声音的程序,我有一个函数gstfreerc(),该函数应该在程序关闭时释放资源,但会引发错误。除此之外,该程序还可以完美运行。

gstfreerc的代码:

void gstfreerc() {
  sleep(1);
  puts("Freeing msg.");
  if (msg != NULL)
    gst_message_unref(msg);
  puts("Freeing bus.");
  if (bus != NULL)
    gst_object_unref(bus);
  puts("Setting pipeline null.");
  if (pipeline != NULL) {
    gst_element_set_state(pipeline, GST_STATE_NULL);
    //puts("Setting pipline null.");
    //pipeline = NULL;
    puts("Freeing pipeline.");
   // pipeline = NULL;
    gst_object_unref(pipeline);
  }
  puts("Freed pipeline.");
  //clean up langctrl pipeline
  puts("Returned, stopping playback.");
  /*puts("Setting language control pipeling null.");
  if (pipelinex != NULL) {
    gst_element_set_state(pipelinex, GST_STATE_NULL);
  }
  puts("Deleting pipeline.");
  if (pipelinex != NULL) {
    gst_object_unref(GST_OBJECT(pipelinex));
  }
  if (bus_watch_id != NULL) {
    g_source_remove(bus_watch_id);
  }
  if (loopx != NULL) {
    g_main_loop_unref(loopx);
  }*/
}

我得到的错误:

(server.out:4113): GStreamer-CRITICAL **: gst_atomic_queue_pop: assertion 'queue != NULL' failed

(server.out:4113): GStreamer-CRITICAL **: gst_atomic_queue_pop: assertion 'queue != NULL' failed

(server.out:4113): GStreamer-CRITICAL **: gst_atomic_queue_pop: assertion 'queue != NULL' failed

(server.out:4113): GStreamer-CRITICAL **: gst_atomic_queue_pop: assertion 'queue != NULL' failed
**
GStreamer:ERROR:gstbus.c:580:gst_bus_timed_pop_filtered: assertion failed: (bus->priv->poll)
Freed pipeline.
Abgebrochen

请告诉我如何正确执行此操作。谢谢

0 个答案:

没有答案