4

I'm new to Kurento media server, I am trying to send an event from kurento media server to the java application which I have.

I have created an event using the following steps:

edited the interface json file:

"events": [{
    "properties": [{
        "name": "Total",
        "doc": "Total",
        "type": "float"
    }],
    "extends": "Media",
    "name": "TotalDetected",
    "doc": "Total Detected."
}]

then in my .hpp file:

sigc::signal<void, TotalDetected> signalTotalDetected;

and in my .cpp file:

try {
    GST_WARNING ("Sending Event: TotalDetected");
    TotalDetected event (shared_from_this(), "Total-detected", total);
        signalTotalDetected (event);
    GST_WARNING ("Sent Event: TotalDetected");
    } catch (std::bad_weak_ptr &e) { 
    GST_WARNING ("EXCEPTION: Total detected ");
}

and in my java server I have registered to the event using:

totalFilter.addTotalDetectedListener(new EventListener<TotalDetectedEvent>() {
    @Override
    public void onEvent(TotalDetectedEvent event) {
        log.info("\n\nTotal Detected Event By:"+event.getTotal());
    }
});

but after doing all this, I am unable to receive any event from kms, I looked into the kms logs I am getting the logs of event being sent but I am not getting any event on java server side.

Is there anything I am missing in the code?

Edit 1: on eclipse console I get this log

[KurentoClient]  Req->
   {
       "id":17,
       "method":"subscribe",
       "params":{
          "object":"fcffbeb5-4ee0-4b49-ba05-a7bc7e716b2f_kurento.MediaPipeline/cb218dbd-0d4a-48cd-88ee-e6ecaf9f4350_vadcustomfilter.VADCustomFilter",
          "type":"TotalReceived",
          "sessionId":"67361dad-bce7-4ad6-a4ce-a26090190bad"
       },
       "jsonrpc":"2.0"
    }
[KurentoClient]  <-Res 
    {
        "id":17,
        "result":{
            "value":"0f2a346b-49f1-4867-aa7d-45ac3780bbbd",
            "sessionId":"67361dad-bce7-4ad6-a4ce-a26090190bad"
        },
        "jsonrpc":"2.0"
    }

Edit 2: Following is the output of dpkg -l | egrep -i "kurento|nice|kms"

ii  gstreamer0.10-nice:amd64      -> 0.1.4-1                                   
ii  gstreamer1.0-nice:amd64       -> 0.1.4-1                                   
ii  gstreamer1.5-nice:amd64       -> 0.1.13.1~20160224182402.77.g7bbb87a.trusty
ii  kms-cmake-utils               -> 1.3.0.trusty                              
ii  kms-core-6.0                  -> 6.4.0.trusty                              
ii  kms-core-6.0-dev              -> 6.4.0.trusty                              
ii  kms-elements-6.0              -> 6.4.0.trusty                              
ii  kms-elements-6.0-dev          -> 6.4.0.trusty                              
ii  kms-filters-6.0               -> 6.4.0.trusty                              
ii  kms-filters-6.0-dev           -> 6.4.0.trusty                              
ii  kms-jsonrpc-1.0               -> 1.1.0.trusty                              
ii  kms-jsonrpc-1.0-dev           -> 1.1.0.trusty                              
ii  kmsjsoncpp                    -> 1.6.3~20160119154506.38.g263929e.trusty   
ii  kmsjsoncpp-dev                -> 1.6.3~20160119154506.38.g263929e.trusty   
ii  kurento-media-server-6.0      -> 6.4.0.trusty                              
ii  kurento-media-server-6.0-dev  -> 6.4.0.trusty                              
ii  kurento-module-creator-4.0    -> 4.0.4.trusty                              
ii  libnice-dev                   -> 0.1.7.1~20160119154918.10.ge060eb5.trusty 
ii  libnice10:amd64               -> 0.1.7.1~20160119154918.10.ge060eb5.trusty 
mateuscb
  • 10,150
  • 3
  • 52
  • 76
Sagar Pilkhwal
  • 3,998
  • 2
  • 25
  • 77
  • I am trying to trigger an event in my plugin(To send response to client). Is the above steps is enough to trigger a event? Or Do I want to implement "gst plugin" or anything else. I have referred some kms filter samples. But I didn't get exact step to send a value in the event (didn't get any documentation). When I do the above steps I am getting the below error :: "error 'shared_from_this' was not declared in this scope". Note::: I am using Opencv module. Can you please help me to do this? Thanks. – SKK Apr 04 '16 at 09:39
  • use `this` instead of `static` method for `error shared_from_this` and yes sendign event from kms custom plugin to java server works well in the steps mentioned here. – Sagar Pilkhwal Apr 04 '16 at 10:20
  • Thanks for the reply. I have used the OpenCV module. When I add the Events in "interface" Json and try to do cmake, I got 4 generated files in the object folder. In which CPP I have to made changes. I have "moduleImpl.cpp, moduleImpl.hpp, moduleOpenCVImpl.cpp and moduleOpenCVImpl.hpp" files. I have added my logics in the "moduleOpenCVImpl.cpp" file. Can you help me to move forward? – SKK Apr 04 '16 at 10:44
  • if you want to send event from kms custom plugin to java server then take a look at this example https://github.com/Kurento/kms-platedetector there is no relation of your plugin being open cv or not i guess – Sagar Pilkhwal Apr 04 '16 at 11:52
  • I have looked in that example. In the OpenCV module implementation documentation, they mentioned that "The first two files should not be modified. The last two files will contain the logic of your module"(Ref: http://doc-kurento.readthedocs.org/en/stable/mastering/develop_kurento_modules.html#opencv-module). But in the given example, the first two files only generated and modified for the Events (Because GStreamer module). So I didn't get clear way to implement this in the OpenCV module. Do you have any idea about this? – SKK Apr 04 '16 at 12:06
  • No, I have not worked on any OpenCV module, I guess you should ask a new question someone might be able to help you. but i think for opencv and gstreamer modules sending events from plugin to java will be the same – Sagar Pilkhwal Apr 04 '16 at 12:20

2 Answers2

3

Try upgrading your libnice version to 0.1.13 this is the source of the errors with some ice candidates. Let's see if this solves the issue with the events.

santoscadenas
  • 1,482
  • 9
  • 17
  • I tried my custom module with kms 6.5 I an getting this error when kms tries to load the module `undefined symbol: _ZTv0_n80_N7kurento15MediaObjectImpl9SerializeERNS_14JsonSerializerE` – Sagar Pilkhwal Jun 06 '16 at 12:23
1

Everything seems OK. You just need to be sure if the event is fired.

If you change warnings by errors you will be able to see your log without configuring anything. This way you can know if the event is being fired.

If you can't see your logs, the you may have a problem firing the event from GStreamer element or maybe registering for the signal from cpp.

santoscadenas
  • 1,482
  • 9
  • 17
  • yes I am able to see the logs but I am not receiving this event on java server. – Sagar Pilkhwal Mar 09 '16 at 07:40
  • 1
    I get this error on eclipse console: `<-Res {"id":19,"error":{"code":40401,"message":"Error adding candidate","data":{"type":"ICE_ADD_CANDIDATE_ERROR"}},"jsonrpc":"2.0"}` when any client connects `Req-> .... "operation":"addIceCandidate ....` – Sagar Pilkhwal Mar 09 '16 at 07:53
  • Have you updated kms packages to version 6.4.0? You also need libnice version 0.1.13 – santoscadenas Mar 09 '16 at 09:27
  • @SagarPilkhwal probably the events are not received on Java because this errors, it depends on applications, but usually they release everything when they get an error. Try upgrading, as I said, to avoid the errors and see if the event reaches the application server. – santoscadenas Mar 09 '16 at 09:32
  • I have the following packages installed `kurento-media-server-6.0, kurento-media-server-6.0-dev, kurento-module-creator-4.0, libnice-dev, libnice10:amd64` – Sagar Pilkhwal Mar 09 '16 at 09:36
  • I guess, otherwise nothing could work :) but what are the versions of those packages? – santoscadenas Mar 09 '16 at 09:38
  • Just paste the output of this command `dpkg -l | egrep -i "kurento|nice|kms"` – santoscadenas Mar 09 '16 at 09:51