Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes on pressing Back button #42

Open
azfarsiddiqui opened this issue Apr 28, 2015 · 12 comments
Open

App crashes on pressing Back button #42

azfarsiddiqui opened this issue Apr 28, 2015 · 12 comments

Comments

@azfarsiddiqui
Copy link

When I press the back button on RtcActivity, the app crashes on 'videoSource.dispose()' inside 'WebRtcClient->onDestroy()' method. Looking at the issues list, this seems to be a fixed, but I am still witnessing this. I am using API level 21 and build tools 21.1.2. Following is the error message I see in Logcat:

Fatal error in ../../talk/app/webrtc/java/jni/peerconnection_jni.cc, line 926
Check failed: 0 == (reinterpret_cast(j_p))->Release() (0 vs. 1)
Unexpected refcount.

P.S: I did not choose any option to 'Call someone', I just pressed the back button to dismiss the chooser. Also, there was no inbound connection i.e. no one was viewing my stream.

@rimmer
Copy link

rimmer commented May 6, 2015

Got the same problem, and can't figure out, why it happens.

@RyanRamchandar
Copy link
Contributor

@azfarsiddiqui
Copy link
Author

@rimmer, @RyanRamchandar First of all the code crashes on videoSource.dispose(), when I comment out this line, the code does not crash. However, as a ripple effect, I cannot start the video source again as access to camera is not released. If the app is restarted, it all functions well. As a workaround, I had to release the camera by a non conventional way i.e. killing the activity the hard way:

public void onDestroy() {
        super.onDestroy();
        android.os.Process.killProcess(android.os.Process.myPid());
}

@pchab
Copy link
Owner

pchab commented May 20, 2015

Can someone test with videoSource.stop() ? (i've made a commit with the change)

@rimmer
Copy link

rimmer commented May 20, 2015

@pchab that seems to fix the problem for me. Will check once more. Thanks!
@azfarsiddiqui when I was trying to find the source of the crash I tried to remove videoSource.dispose() and all of the resource freeing operations in onDestroy, but that not helped.

@RyanRamchandar
Copy link
Contributor

@pchab That does remove the Force Close from happening though I don't think it's a good solution since the Activity instance now leaks because it still has a reference to VideoSource (I believe). I confirmed this with LeakCanary.

Also, videoSource.stop() is already called in onPause() and calling it again in onDestroy() is redundant.

@pchab
Copy link
Owner

pchab commented May 26, 2015

I'll follow https://code.google.com/p/webrtc/issues/detail?id=4303 and revert to videoSource.dispose() once it's been fixed

@hoang89yenthe
Copy link

@pchab @azfarsiddiqui Do you have the appropriate solution for this yet?

@pouracc
Copy link

pouracc commented Dec 28, 2015

@pchab I had the same problem. Have you had any solutions?

@Bala206
Copy link

Bala206 commented Jan 4, 2016

  1. When you start AndroidRTC app on device-1 then it will show a popup. Call someone
    Share the link from device-1 to device-2 (via email, whatsapp sms etc)
    in device-2 you will get that link
    click that link
    Android will let you choose from different apps (like chrome, browser and AndroidRTC)
    choose AndroidRTC. Now Device-1 App Crashed ?

  2. And Also Browser shows device-list.In list View button shows device video streaming correctly.
    When click on Call button device side App crash?

Can any one know answer help me how to fix it?

@alshakero
Copy link

My current silly walk around is to start the call activity in a separate process then kill it onDestroy using @azfarsiddiqui code.
Just add android:process=":YourProcessName" to your call activity in AndroidManifest and the Activity should start in a different safely-killable process.

<activity
     android:name=".YourActivity"
     android:screenOrientation="portrait"
     android:process=":YourProcessName">
     <intent-filter>
          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />
     </intent-filter>
</activity>
public void onDestroy() {
        super.onDestroy();
        android.os.Process.killProcess(android.os.Process.myPid());
}

@Micheloss
Copy link

Hi guys,

I have included this walk around @azfarsiddiqui to my code and is working as a charm, but I would like to know if there is any kind of patch or something related to solving this problem/bug.

Also I would like to ask, what version of libjingle do you use in your projects?

Best,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants