4

Do you have any idea regarding this problem:when I dismiss a video call received, the app crashes, giving me this error:

11-13 16:59:00.341    6531-6531/appPackage E/SinchVideoService﹕ stop
11-13 16:59:00.341    6531-6531/appPackage D/SinchClient﹕ Degub: terminate()
11-13 16:59:00.351    6531-6698/appPackage E/rtc﹕ #
    # Fatal error in ../../../talk/app/webrtc/androidvideocapturer.cc, line 195
    # Check failed: !running_
    #
    #
11-13 16:59:00.351    6531-6698/appPackage A/libc﹕ Fatal signal 6 (SIGABRT), code -6 in tid 6698 (Sinch Worker Th)

It seems to be a Sinch internal error, any ideas?

----- Edit ------

It happens when the activity gets destroyed:

    @Override
    public void onDestroy()
    {
       if (getSinchServiceInterface() != null)
       {
           getSinchServiceInterface().removeMessageClientListener(this);
           getSinchServiceInterface().stopClient();
        }
        super.onDestroy();
    }

when this method (stop()), from the class that extends the Service, gets called.

    private void stop()
    {
        if (mSinchClient != null)
        {
            mSinchClient.terminate();
            mSinchClient = null;
        }
    }

-- Edit ---

This is where I start my client:

    protected void onServiceConnected()
    {
        getSinchServiceInterface().setStartListener(this);
        PreferencesDataAccess prefs = new PreferencesDataAccess(this);
        getSinchServiceInterface().startClient("user-" + prefs.getCurrentUser().getUserID());
        getSinchServiceInterface().addMessageClientListener(this);
    }

and this is where it gets initialized:

    private void start(String userName)
    {
        if (mSinchClient == null)
        {
            mUserId = userName;
            mSinchClient = Sinch.getSinchClientBuilder().context(getApplicationContext()).userId(userName)
                    .applicationKey(APP_KEY)
                    .applicationSecret(APP_SECRET)
                    .environmentHost(ENVIRONMENT).build();

            mSinchClient.setSupportCalling(true);
            mSinchClient.setSupportMessaging(true);
            mSinchClient.startListeningOnActiveConnection();

            mSinchClient.addSinchClientListener(new MySinchClientListener());
            mSinchClient.getCallClient().addCallClientListener(new SinchCallClientListener());
            mSinchClient.start();

        }
    }
Alina
  • 142
  • 2
  • 13

2 Answers2

1

Use terminateGracefully() instead of Terminate. this will wait for some network events and shut down the client gracefully.

Also your should not stop the sinch client just because you decline a call. The sinch client should live in your app so you can receive a call. The only times you should stop the sinch client is: - The user logs out of you app and you don't want to receive calls at all for this client.

When when hitting deny on a call, you just call "hangup" on it, dont kill the client.

cjensen
  • 2,703
  • 1
  • 16
  • 15
  • I tried this, but it still gives me the same error. – Alina Nov 17 '15 at 20:44
  • Ok, I know its not really solving, but you shouldnt really terminate the sinchClient in the activity, in fact terminateGracefully should only be called in a log out scenario. Because if you terminate it you wont be able to receive calls – cjensen May 23 '16 at 18:39
0

You need to call

sinchClient.stopListeningOnActiveConnection();

before you call terminate(); else you will get an invalid object passed to the SinchClientListener.

harry2680
  • 1
  • 3