コード例 #1
0
std::string SdpEndpointImpl::processAnswer (const std::string &answer)
{
  GstSDPMessage *answerSdp;
  std::string resultStr;
  bool expected = true;
  bool expected_false = false;

  if (!waitingAnswer.compare_exchange_strong (expected, true) ) {
    //offer not generated
    throw KurentoException (SDP_END_POINT_NOT_OFFER_GENERATED,
                            "Offer not generated. It is not possible to process an answer.");
  }

  if (!answerProcessed.compare_exchange_strong (expected_false, true) ) {
    //the endpoint is already negotiated
    throw KurentoException (SDP_END_POINT_ANSWER_ALREADY_PROCCESED,
                            "Sdp Answer already processed");
  }

  answerSdp = str_to_sdp (answer);
  g_signal_emit_by_name (element, "process-answer", answerSdp, NULL);
  gst_sdp_message_free (answerSdp);

  MediaSessionStarted event (shared_from_this(), MediaSessionStarted::getName() );
  signalMediaSessionStarted (event);

  return getLocalSessionDescriptor ();
}
コード例 #2
0
ファイル: MixerImpl.cpp プロジェクト: TribeMedia/kms-elements
void MixerImpl::disconnect (std::shared_ptr<MediaType> media,
                            std::shared_ptr<HubPort> source, std::shared_ptr<HubPort> sink)
{
  std::shared_ptr<HubPortImpl> sourcePort =
    std::dynamic_pointer_cast<HubPortImpl> (source);
  std::shared_ptr<HubPortImpl> sinkPort =
    std::dynamic_pointer_cast<HubPortImpl> (sink);
  std::string  action;
  bool connected;

  switch (media->getValue() ) {
  case MediaType::AUDIO:
    action = "disconnect-audio";
    break;

  case MediaType::VIDEO:
    throw KurentoException (UNSUPPORTED_MEDIA_TYPE,
                            "Video disconnection is not implemented yet");

  default:
    /* Only audio is suppported so far */
    throw KurentoException (UNSUPPORTED_MEDIA_TYPE, "Invalid media type");
  };

  g_signal_emit_by_name (G_OBJECT (element), action.c_str(),
                         sourcePort->getHandlerId(),
                         sinkPort->getHandlerId(),
                         &connected);

  if (!connected) {
    throw KurentoException (CONNECT_ERROR, "Can not connect video ports");
  }
}
コード例 #3
0
std::string SdpEndpointImpl::processOffer (const std::string &offer)
{
  GstSDPMessage *offerSdp = NULL, *result = NULL;
  std::string offerSdpStr;
  bool expected = false;

  if (!offerInProcess.compare_exchange_strong (expected, true) ) {
    //the endpoint is already negotiated
    throw KurentoException (SDP_END_POINT_ALREADY_NEGOTIATED,
                            "Endpoint already negotiated");
  }

  offerSdp = str_to_sdp (offer);
  g_signal_emit_by_name (element, "process-offer", offerSdp, &result);
  gst_sdp_message_free (offerSdp);

  if (result == NULL) {
    offerInProcess = false;
    throw KurentoException (SDP_END_POINT_PROCESS_OFFER_ERROR,
                            "Error processing offer");
  }

  sdp_to_str (offerSdpStr, result);
  gst_sdp_message_free (result);

  MediaSessionStarted event (shared_from_this(), MediaSessionStarted::getName() );
  signalMediaSessionStarted (event);

  return offerSdpStr;
}
コード例 #4
0
std::string SdpEndpointImpl::generateOffer ()
{
  GstSDPMessage *offer = NULL;
  std::string offerStr;
  bool expected = false;

  if (!offerInProcess.compare_exchange_strong (expected, true) ) {
    //the endpoint is already negotiated
    throw KurentoException (SDP_END_POINT_ALREADY_NEGOTIATED,
                            "Endpoint already negotiated");
  }

  if (element == NULL) {
  }

  g_signal_emit_by_name (element, "generate-offer", &offer);

  if (offer == NULL) {
    offerInProcess = false;
    throw KurentoException (SDP_END_POINT_GENERATE_OFFER_ERROR,
                            "Error generating offer");
  }

  sdp_to_str (offerStr, offer);
  gst_sdp_message_free (offer);
  waitingAnswer = true;

  return offerStr;
}
コード例 #5
0
void
WebRtcEndpointImpl::createDataChannel (const std::string &label, bool ordered,
                                       int maxPacketLifeTime, int maxRetransmits, const std::string &protocol)
{
  gint lifeTime, retransmits, stream_id;
  gboolean supported;

  g_object_get (element, "data-channel-supported", &supported, NULL);

  if (!supported) {
    throw KurentoException (MEDIA_OBJECT_OPERATION_NOT_SUPPORTED,
                            "Data channels are not supported");
  }

  /* Less than one values mean that parameters are disabled */
  if (maxPacketLifeTime < 0) {
    maxPacketLifeTime = -1;
  }

  if (maxRetransmits < 0) {
    maxRetransmits = -1;
  }

  if (maxPacketLifeTime != -1 && maxRetransmits != -1) {
    /* Both values are incompatible.                                     */
    /* http://w3c.github.io/webrtc-pc/#dom-datachannel-maxpacketlifetime */
    throw KurentoException (MEDIA_OBJECT_ILLEGAL_PARAM_ERROR, "Syntax error");
  }

  if (maxPacketLifeTime > G_MAXUSHORT) {
    GST_WARNING ("maxPacketLifeTime can not be bigger than %u. Setting it to that value",
                 G_MAXUSHORT);
    lifeTime = G_MAXUSHORT;
  } else {
    lifeTime = maxPacketLifeTime;
  }

  if (maxRetransmits > G_MAXUSHORT) {
    GST_WARNING ("maxRetransmits can not be bigger than %u. Setting it to that value",
                 G_MAXUSHORT);
    retransmits = G_MAXUSHORT;
  } else {
    retransmits = maxRetransmits;
  }

  /* Create the data channel */
  g_signal_emit_by_name (element, "create-data-channel", ordered, lifeTime,
                         retransmits, label.c_str(), protocol.c_str(),
                         &stream_id);

  if (stream_id < 0) {
    throw KurentoException (UNEXPECTED_ERROR, "Can not create data channel");
  }

  GST_DEBUG ("Creating data channel with stream id %d", stream_id);
}
コード例 #6
0
ファイル: MediaSet.cpp プロジェクト: DavidYangfei/kms-core
std::shared_ptr< MediaObjectImpl >
MediaSet::getMediaObject (const std::string &mediaObjectRef)
{
  if (mediaObjectRef.size() > NEW_REF.size()
      && mediaObjectRef.substr (0, NEW_REF.size() ) == NEW_REF) {
    throw KurentoException (MEDIA_OBJECT_NOT_FOUND_TRANSACTION_NO_COMMIT,
                            "Object '" + mediaObjectRef +
                            "' not found. Possibly using a transactional " +
                            "object without committing the transaction.");
  }

  std::shared_ptr <MediaObjectImpl> objectLocked;
  std::unique_lock <std::recursive_mutex> lock (recMutex);

  auto it = objectsMap.find (mediaObjectRef);

  if (it == objectsMap.end() ) {
    throw KurentoException (MEDIA_OBJECT_NOT_FOUND,
                            "Object '" + mediaObjectRef + "' not found");
  }

  try {
    objectLocked = it->second.lock();
  } catch (...) {
    throw KurentoException (MEDIA_OBJECT_NOT_FOUND,
                            "Object '" + mediaObjectRef + "' not found");
  }

  if (!objectLocked) {
    throw KurentoException (MEDIA_OBJECT_NOT_FOUND,
                            "Object '" + mediaObjectRef + "' not found");
  }

  auto it2 = reverseSessionMap.find (objectLocked->getId() );

  if (it2 == reverseSessionMap.end() || it2->second.empty() ) {
    if (serverManager && mediaObjectRef == serverManager->getId() ) {
      return serverManager;
    }

    throw KurentoException (MEDIA_OBJECT_NOT_FOUND,
                            "Object '" + mediaObjectRef + "' not found");
  }

  return objectLocked;
}
コード例 #7
0
static GstStructure *
get_structure_from_roi (std::shared_ptr<RegionOfInterest> roi)
{
  GstStructure *roiStructure, *configRoiSt;
  std::shared_ptr<RegionOfInterestConfig> config;
  int pointCount = 0;

  roiStructure = gst_structure_new_empty (roi->getId().c_str() );

  if (roiStructure == NULL) {
    throw KurentoException (MEDIA_OBJECT_ILLEGAL_PARAM_ERROR,
                            "Invalid roi name");
  }

  for (std::shared_ptr<RelativePoint> point : roi->getPoints() ) {
    GstStructure *pointSt;
    std::string name = "point" + std::to_string (pointCount ++);

    pointSt = gst_structure_new (name.c_str(),
                                 "x", G_TYPE_FLOAT, point->getX(),
                                 "y", G_TYPE_FLOAT, point->getY(),
                                 NULL);

    gst_structure_set (roiStructure,
                       name.c_str(), GST_TYPE_STRUCTURE, pointSt,
                       NULL);

    gst_structure_free (pointSt);
  }

  config = roi->getRegionOfInterestConfig();
  configRoiSt = gst_structure_new ("config",
                                   "id", G_TYPE_STRING, roi->getId().c_str(),
                                   "occupancy_level_min", G_TYPE_INT, config->getOccupancyLevelMin(),
                                   "occupancy_level_med", G_TYPE_INT, config->getOccupancyLevelMed(),
                                   "occupancy_level_max", G_TYPE_INT, config->getOccupancyLevelMax(),
                                   "occupancy_num_frames_to_event", G_TYPE_INT,
                                   config->getOccupancyNumFramesToEvent(),
                                   "fluidity_level_min", G_TYPE_INT, config->getFluidityLevelMin(),
                                   "fluidity_level_med", G_TYPE_INT, config->getFluidityLevelMed(),
                                   "fluidity_level_max", G_TYPE_INT, config->getFluidityLevelMax(),
                                   "fluidity_num_frames_to_event", G_TYPE_INT,
                                   config->getFluidityNumFramesToEvent(),
                                   "send_optical_flow_event", G_TYPE_BOOLEAN, config->getSendOpticalFlowEvent(),
                                   "optical_flow_num_frames_to_event", G_TYPE_INT,
                                   config->getOpticalFlowNumFramesToEvent(),
                                   "optical_flow_num_frames_to_reset", G_TYPE_INT,
                                   config->getOpticalFlowNumFramesToReset(),
                                   "optical_flow_angle_offset", G_TYPE_INT, config->getOpticalFlowAngleOffset(),
                                   NULL);
  gst_structure_set (roiStructure,
                     "config", GST_TYPE_STRUCTURE, configRoiSt,
                     NULL);

  gst_structure_free (configRoiSt);

  return roiStructure;
}
コード例 #8
0
void
checkResources (void)
{
  int nThreads;

  nThreads = getNumberOfThreads ();

  if (nThreads > maxThreads) {
    throw KurentoException (NOT_ENOUGH_RESOURCES, "Too many threads");
  }
}
コード例 #9
0
HttpGetEndpointImpl::HttpGetEndpointImpl (
  const boost::property_tree::ptree &conf,
  std::shared_ptr<MediaPipeline> mediaPipeline, bool terminateOnEOS,
  std::shared_ptr<MediaProfileSpecType> mediaProfile,
  int disconnectionTimeout) : HttpEndpointImpl (conf,
        std::dynamic_pointer_cast< MediaObjectImpl > (mediaPipeline),
        disconnectionTimeout, FACTORY_NAME)
{
  g_object_set ( G_OBJECT (element), "accept-eos", terminateOnEOS,
                 NULL);

  switch (mediaProfile->getValue() ) {
  case MediaProfileSpecType::WEBM:
    GST_INFO ("Set WEBM profile");
    g_object_set ( G_OBJECT (element), "profile", KMS_RECORDING_PROFILE_WEBM, NULL);
    break;

  case MediaProfileSpecType::MP4:
    GST_INFO ("Set MP4 profile");
    g_object_set ( G_OBJECT (element), "profile", KMS_RECORDING_PROFILE_MP4, NULL);
    break;

  case MediaProfileSpecType::WEBM_VIDEO_ONLY:
    g_object_set ( G_OBJECT (element), "profile",
                   KMS_RECORDING_PROFILE_WEBM_VIDEO_ONLY, NULL);
    GST_INFO ("Set WEBM profile");
    break;

  case MediaProfileSpecType::WEBM_AUDIO_ONLY:
    g_object_set ( G_OBJECT (element), "profile",
                   KMS_RECORDING_PROFILE_WEBM_AUDIO_ONLY, NULL);
    GST_INFO ("Set WEBM profile");
    break;

  case MediaProfileSpecType::MP4_VIDEO_ONLY:
    g_object_set ( G_OBJECT (element), "profile",
                   KMS_RECORDING_PROFILE_MP4_VIDEO_ONLY, NULL);
    GST_INFO ("Set WEBM profile");
    break;

  case MediaProfileSpecType::MP4_AUDIO_ONLY:
    g_object_set ( G_OBJECT (element), "profile",
                   KMS_RECORDING_PROFILE_MP4_AUDIO_ONLY, NULL);
    GST_INFO ("Set WEBM profile");
    break;
  }

  register_end_point();

  if (!is_registered() ) {
    throw KurentoException (HTTP_END_POINT_REGISTRATION_ERROR,
                            "Cannot register HttpGetEndPoint");
  }
}
コード例 #10
0
static void
checkOpenFiles (float limit_percent)
{
  int nOpenFiles;

  nOpenFiles = getNumberOfOpenFiles ();

  if (nOpenFiles > getMaxOpenFiles () * limit_percent ) {
    throw KurentoException (NOT_ENOUGH_RESOURCES, "Too many open files");
  }
}
コード例 #11
0
static void
checkThreads (float limit_percent)
{
  int nThreads;

  nThreads = getNumberOfThreads ();

  if (nThreads > getMaxThreads () * limit_percent ) {
    throw KurentoException (NOT_ENOUGH_RESOURCES, "Too many threads");
  }
}
コード例 #12
0
std::string MediaObjectImpl::getTag (const std::string &key)
{
  auto it = tagsMap.find (key);

  if (it != tagsMap.end() ) {
    return it->second;
  }

  throw KurentoException (MEDIA_OBJECT_TAG_KEY_NOT_FOUND,
                          "Tag key not found");
}
コード例 #13
0
void
WebRtcEndpointImpl::gatherCandidates ()
{
  gboolean ret;

  g_signal_emit_by_name (element, "gather-candidates", &ret);

  if (!ret) {
    throw KurentoException (ICE_GATHER_CANDIDATES_ERROR,
                            "Error gathering candidates");
  }
}
コード例 #14
0
void
ServerMethods::subscribe (const Json::Value &params, Json::Value &response)
{
  std::shared_ptr<MediaObjectImpl> obj;
  std::string eventType;
  std::string handlerId;
  std::string sessionId;
  std::string objectId;

  requireParams (params);

  JsonRpc::getValue (params, TYPE, eventType);
  JsonRpc::getValue (params, OBJECT, objectId);

  getOrCreateSessionId (sessionId, params);

  try {
    obj = MediaSet::getMediaSet()->getMediaObject (sessionId, objectId);

    try {
      handlerId = eventSubscriptionHandler (obj, sessionId, eventType, params);
    } catch (std::bad_function_call &e) {
      throw KurentoException (NOT_IMPLEMENTED,
                              "Current transport does not support events");
    }

    if (handlerId == "") {
      throw KurentoException (MEDIA_OBJECT_EVENT_NOT_SUPPORTED, "Event not found");
    }
  } catch (KurentoException &ex) {
    Json::Value data;

    data[TYPE] = ex.getType();

    throw JsonRpc::CallException (ex.getCode (), ex.getMessage (), data);
  }

  response[SESSION_ID] = sessionId;
  response[VALUE] = handlerId;
}
コード例 #15
0
ファイル: NuboTrackerImpl.cpp プロジェクト: veeramarni/VCA
  NuboTrackerImpl::NuboTrackerImpl (const boost::property_tree::ptree &config, std::shared_ptr<MediaPipeline> mediaPipeline)  :  FilterImpl (config, std::dynamic_pointer_cast<MediaPipelineImpl> (mediaPipeline)) 
{
  	g_object_set (element, "filter-factory", "nubotracker", NULL);

	g_object_get (G_OBJECT (element), "filter", &nubo_tracker, NULL);

	if (NULL == nubo_tracker) {
	  throw KurentoException (MEDIA_OBJECT_NOT_AVAILABLE,
				  "Media Object not available");
	}
 
	g_object_unref(nubo_tracker);
}
コード例 #16
0
Json::Value F::getFirstEvent ()
{
  for (auto it = recvMessages.begin(); it != recvMessages.end(); it++) {
    Json::Value message = *it;

    if (isEvent (message) ) {
      recvMessages.erase (it);
      return message;
    }
  }

  throw KurentoException (UNEXPECTED_ERROR, "Resonse not found");
}
コード例 #17
0
Json::Value F::getResponse (const std::string &requestId)
{
  for (auto it = recvMessages.begin(); it != recvMessages.end(); it++) {
    Json::Value message = *it;

    if (isResponse (message, requestId) ) {
      recvMessages.erase (it);
      return message;
    }
  }

  throw KurentoException (UNEXPECTED_ERROR, "Resonse not found");
}
コード例 #18
0
void SdpEndpointImpl::postConstructor ()
{
  gchar *sess_id;

  g_signal_emit_by_name (element, "create-session", &sess_id);

  if (sess_id == NULL) {
    throw KurentoException (SDP_END_POINT_CANNOT_CREATE_SESSON,
                            "Cannot create session");
  }

  sessId = std::string (sess_id);
  g_free (sess_id);
}
コード例 #19
0
static GstSDPMessage *
str_to_sdp (const std::string &sdpStr)
{
  GstSDPResult result;
  GstSDPMessage *sdp = NULL;

  result = gst_sdp_message_new (&sdp);

  if (result != GST_SDP_OK) {
    throw KurentoException (SDP_CREATE_ERROR, "Error creating SDP message");
  }

  result = gst_sdp_message_parse_buffer ( (const guint8 *) sdpStr.c_str (), -1,
                                          sdp);

  if (result != GST_SDP_OK) {

    gst_sdp_message_free (sdp);
    throw KurentoException (SDP_PARSE_ERROR, "Error parsing SDP");
  }

  return sdp;
}
コード例 #20
0
void
ServerMethods::invoke (const Json::Value &params, Json::Value &response)
{
  std::shared_ptr<MediaObject> obj;
  std::string sessionId;
  std::string operation;
  Json::Value operationParams;
  std::string objectId;

  requireParams (params);

  JsonRpc::getValue (params, "operation", operation);
  JsonRpc::getValue (params, OBJECT, objectId);

  try {
    JsonRpc::getValue (params, "operationParams", operationParams);
  } catch (JsonRpc::CallException e) {
    /* operationParams is optional at this point */
  }

  try {
    JsonRpc::getValue (params, SESSION_ID, sessionId);
  } catch (JsonRpc::CallException e) {
    generateUUID (sessionId);
  }

  try {
    Json::Value value;

    obj = MediaSet::getMediaSet().getMediaObject (sessionId, objectId);

    if (!obj) {
      throw KurentoException (MEDIA_OBJECT_NOT_FOUND, "Object not found");
    }

    obj->getInvoker().invoke (obj, operation, operationParams, value);

    response["value"] = value;
    response["sessionId"] = sessionId;
  } catch (KurentoException &ex) {
    Json::Value data;
    data["code"] = ex.getCode();
    data["message"] = ex.getMessage();

    JsonRpc::CallException e (JsonRpc::ErrorCode::SERVER_ERROR_INIT,
                              ex.what(), data);
    throw e;
  }
}
void
SamplePluginFilter_js_mvImpl::Serialize (JsonSerializer &serializer)
{
  if (serializer.IsWriter) {
    try {
      Json::Value v (getId() );

      serializer.JsonValue = v;
    } catch (std::bad_cast &e) {
    }
  } else {
    throw KurentoException (MARSHALL_ERROR,
                            "'SamplePluginFilter_js_mvImpl' cannot be deserialized as an object");
  }
}
コード例 #22
0
FaceOverlayFilterImpl::FaceOverlayFilterImpl (
  std::shared_ptr< MediaObjectImpl > parent) :
  FilterImpl (parent)
{
  g_object_set (element, "filter-factory", "faceoverlay", NULL);

  g_object_get (G_OBJECT (element), "filter", &faceOverlay, NULL);

  if (faceOverlay == NULL) {
    throw KurentoException (MEDIA_OBJECT_NOT_AVAILABLE,
                            "Media Object not available");
  }

  g_object_unref (faceOverlay);
}
コード例 #23
0
void
WebRtcEndpointImpl::closeDataChannel (int channelId)
{
  gboolean supported;

  g_object_get (element, "data-channel-supported", &supported, NULL);

  if (!supported) {
    throw KurentoException (MEDIA_OBJECT_OPERATION_NOT_SUPPORTED,
                            "Data channels are not supported");
  }

  /* Destroy the data channel */
  g_signal_emit_by_name (element, "destroy-data-channel", channelId);
}
コード例 #24
0
std::string SdpEndpointImpl::getRemoteSessionDescriptor ()
{
  GstSDPMessage *remoteSdp = NULL;
  std::string remoteSdpStr;

  g_signal_emit_by_name (element, "get-remote-sdp", sessId.c_str (), &remoteSdp);

  if (remoteSdp == NULL) {
    throw KurentoException (SDP_END_POINT_NO_REMOTE_SDP_ERROR, "No remote SDP");
  }

  sdp_to_str (remoteSdpStr, remoteSdp);;
  gst_sdp_message_free (remoteSdp);

  return remoteSdpStr;
}
コード例 #25
0
std::string SdpEndpointImpl::getRemoteSessionDescriptor ()
{
  GstSDPMessage *remoteSdp = NULL;
  std::string remoteSdpStr;

  g_object_get (element, "remote-sdp", &remoteSdp, NULL);

  if (remoteSdp == NULL) {
    throw KurentoException (SDP_END_POINT_NO_REMOTE_SDP_ERROR, "No remote SDP");
  }

  sdp_to_str (remoteSdpStr, remoteSdp);;
  gst_sdp_message_free (remoteSdp);

  return remoteSdpStr;
}
コード例 #26
0
std::string SdpEndpointImpl::getLocalSessionDescriptor ()
{
  GstSDPMessage *localSdp = NULL;
  std::string localSdpStr;

  g_object_get (element, "local-sdp", &localSdp, NULL);

  if (localSdp == NULL) {
    throw KurentoException (SDP_END_POINT_NO_LOCAL_SDP_ERROR, "No local SDP");
  }

  sdp_to_str (localSdpStr, localSdp);
  gst_sdp_message_free (localSdp);

  return localSdpStr;
}
コード例 #27
0
KmsShowFacesImpl::KmsShowFacesImpl (const boost::property_tree::ptree &config,
                                    std::shared_ptr<MediaPipeline> mediaPipeline) :
  FilterImpl (config,
              std::dynamic_pointer_cast<MediaObjectImpl> ( mediaPipeline) )
{
  g_object_set (element, "filter-factory", "imageoverlaymetadata", NULL);

  g_object_get (G_OBJECT (element), "filter", &imageOverlay, NULL);

  if (imageOverlay == NULL) {
    throw KurentoException (MEDIA_OBJECT_NOT_AVAILABLE,
                            "Media Object not available");
  }

  g_object_unref (imageOverlay);
}
コード例 #28
0
std::string SdpEndpointImpl::getLocalSessionDescriptor ()
{
  GstSDPMessage *localSdp = NULL;
  std::string localSdpStr;

  g_signal_emit_by_name (element, "get-local-sdp", sessId.c_str (), &localSdp);

  if (localSdp == NULL) {
    throw KurentoException (SDP_END_POINT_NO_LOCAL_SDP_ERROR, "No local SDP");
  }

  sdp_to_str (localSdpStr, localSdp);
  gst_sdp_message_free (localSdp);

  return localSdpStr;
}
コード例 #29
0
std::string
ServerMethods::connectEventHandler (std::shared_ptr<MediaObject> obj,
                                    const std::string &sessionId, const std::string &eventType,
                                    std::shared_ptr<EventHandler> handler)
{
  std::string subscriptionId;

  subscriptionId = obj->connect (eventType, handler);

  if (subscriptionId == "") {
    throw KurentoException (MEDIA_OBJECT_EVENT_NOT_SUPPORTED, "Event not found");
  }

  registerEventHandler (obj, sessionId, subscriptionId, handler);

  return subscriptionId;
}
コード例 #30
0
ZBarFilterImpl::ZBarFilterImpl (const boost::property_tree::ptree &conf,
                                std::shared_ptr<MediaPipeline> mediaPipeline) :
  FilterImpl (conf, std::dynamic_pointer_cast<MediaObjectImpl> ( mediaPipeline) )
{
  g_object_set (element, "filter-factory", "zbar", NULL);
  g_object_get (G_OBJECT (element), "filter", &zbar, NULL);

  if (zbar == NULL) {
    throw KurentoException (MEDIA_OBJECT_NOT_FOUND, "MediaObject not found");
  }

  g_object_set (G_OBJECT (zbar), "qos", FALSE, NULL);

  bus_handler_id = 0;
  // There is no need to reference zbar becase its live cycle is the same as the filter live cycle
  g_object_unref (zbar);
}