Surface had no valid native Surface error on exiting the video call
<p><strong>What steps will reproduce the problem?</strong></p>

<p>1.Tested on SamSung Galaxy TabA </p>

<p>2.Unable to exit One to One video call</p>

<p>3.Surface had no valid native Surface error on ending the video call. </p>

<p><strong>What version of the product are you using? On what operating system?</strong></p>

<p>MarshMallow(Android 6),Samsung Galaxy TabA </p>

<p><strong>Please provide any additional information below.</strong></p>

<p>Using the below code to exit the video call:</p>

<pre><code>    if (factory != null ) {
        factory.stopAecDump();
    }

    Log.d(TAG, "Closing audio source.");
    if (audioSource != null) {
        audioSource.dispose();
        audioSource = null;
    }

    Log.d(TAG, "Stopping capture.");
    if (videoCapturer != null) {
        try {
            videoCapturer.stopCapture();
        } catch(InterruptedException e) {
            throw new RuntimeException(e);
        }
        videoCapturer.dispose();
        videoCapturer = null;
    }
    Log.d(TAG, "Closing video source.");
    if (videoSource != null) {
        videoSource.dispose();
        videoSource = null;
    }
    Log.d(TAG, "Closing peer connection factory.");
    if (factory != null) {
        factory.dispose();
        factory = null;
    }
    if(localSurfaceView != null &amp;&amp; localSurfaceView.isEnabled() )localSurfaceView.release();
    if(remoteSurfaceView != null &amp;&amp; remoteSurfaceView.isEnabled())remoteSurfaceView.release();
</code></pre>

<p><strong>Log:</strong></p>

<p>E/Legacy-CameraDevice-JNI: LegacyCameraDevice_nativeGetSurfaceId: Could not retrieve native Surface from surface.</p>

<p>E/CameraDeviceGLThread-1: Received exception on GL render thread: 
                                                                         java.lang.IllegalArgumentException: Surface had no valid native Surface.</p>

<p>at android.hardware.camera2.legacy.LegacyCameraDevice.nativeGetSurfaceId(Native Method)</p>

<p>at android.hardware.camera2.legacy.LegacyCameraDevice.getSurfaceId(LegacyCameraDe vice.java:658)</p>

<p>at android.hardware.camera2.legacy.LegacyCameraDevice.getSurfaceIds(LegacyCameraDevice.java:667)
                                                                             at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawIntoSurfaces(SurfaceTextureRenderer.java:715)</p>

<p>at android.hardware.camera2.legacy.GLThreadManager$1.handleMessage(GLThreadManager)</p>

<p>at E/BufferQueueProducer: [SurfaceTexture-1-4811-1] cancelBuffer: BufferQueue has been abandoned</p>

<p>10-17 18:10:31.288 4811-4824/com.caprusit.capv E/BufferQueueProducer: [SurfaceTexture-1-4811-1] cancelBuffer: BufferQueue has been abandoned</p>