Alina
Alina

Reputation: 142

Sinch video call hangup crash android

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();

        }
    }

Upvotes: 4

Views: 1021

Answers (2)

cjensen
cjensen

Reputation: 2703

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.

Upvotes: 1

harry2680
harry2680

Reputation: 1

You need to call

sinchClient.stopListeningOnActiveConnection();

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

Upvotes: 0

Related Questions