Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java

Issue 2168623002: Refactor stopCapture to be asynchronous in VideoCapturerAndroid. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@androidvideotracksource
Patch Set: Synchronized. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 peerConnection.dispose(); 568 peerConnection.dispose();
569 peerConnection = null; 569 peerConnection = null;
570 } 570 }
571 Log.d(TAG, "Closing audio source."); 571 Log.d(TAG, "Closing audio source.");
572 if (audioSource != null) { 572 if (audioSource != null) {
573 audioSource.dispose(); 573 audioSource.dispose();
574 audioSource = null; 574 audioSource = null;
575 } 575 }
576 Log.d(TAG, "Stopping capture."); 576 Log.d(TAG, "Stopping capture.");
577 if (videoCapturer != null) { 577 if (videoCapturer != null) {
578 try { 578 videoCapturer.stopCapture();
579 videoCapturer.stopCapture();
580 } catch(InterruptedException e) {
581 throw new RuntimeException(e);
582 }
583 videoCapturer.dispose(); 579 videoCapturer.dispose();
584 videoCapturer = null; 580 videoCapturer = null;
585 } 581 }
586 Log.d(TAG, "Closing video source."); 582 Log.d(TAG, "Closing video source.");
587 if (videoSource != null) { 583 if (videoSource != null) {
588 videoSource.dispose(); 584 videoSource.dispose();
589 videoSource = null; 585 videoSource = null;
590 } 586 }
591 Log.d(TAG, "Closing peer connection factory."); 587 Log.d(TAG, "Closing peer connection factory.");
592 if (factory != null) { 588 if (factory != null) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 757 }
762 }); 758 });
763 } 759 }
764 760
765 public void stopVideoSource() { 761 public void stopVideoSource() {
766 executor.execute(new Runnable() { 762 executor.execute(new Runnable() {
767 @Override 763 @Override
768 public void run() { 764 public void run() {
769 if (videoCapturer != null && !videoCapturerStopped) { 765 if (videoCapturer != null && !videoCapturerStopped) {
770 Log.d(TAG, "Stop video source."); 766 Log.d(TAG, "Stop video source.");
771 try { 767 videoCapturer.stopCapture();
772 videoCapturer.stopCapture();
773 } catch (InterruptedException e) {}
774 videoCapturerStopped = true; 768 videoCapturerStopped = true;
775 } 769 }
776 } 770 }
777 }); 771 });
778 } 772 }
779 773
780 public void startVideoSource() { 774 public void startVideoSource() {
781 executor.execute(new Runnable() { 775 executor.execute(new Runnable() {
782 @Override 776 @Override
783 public void run() { 777 public void run() {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 public void onCreateFailure(final String error) { 1163 public void onCreateFailure(final String error) {
1170 reportError("createSDP error: " + error); 1164 reportError("createSDP error: " + error);
1171 } 1165 }
1172 1166
1173 @Override 1167 @Override
1174 public void onSetFailure(final String error) { 1168 public void onSetFailure(final String error) {
1175 reportError("setSDP error: " + error); 1169 reportError("setSDP error: " + error);
1176 } 1170 }
1177 } 1171 }
1178 } 1172 }
OLDNEW
« no previous file with comments | « webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698