Add option to capture to texture in AppRTCDemo for Android.
The purpose is to be able to easier test and find differences between the path when capturing to textures or byte buffers. This require https://codereview.webrtc.org/1403713002/ to work. BUG=webrtc:4993 R=magjed@webrtc.org TBR=glaznew@webrtc.org Review URL: https://codereview.webrtc.org/1452423003 . Cr-Commit-Position: refs/heads/master@{#10766}
This commit is contained in:
@ -71,6 +71,11 @@
|
||||
<string name="pref_hwcodec_dlg">Use hardware accelerated video codec (if available).</string>
|
||||
<string name="pref_hwcodec_default">true</string>
|
||||
|
||||
<string name="pref_capturetotexture_key">capturetotexture_preference</string>
|
||||
<string name="pref_capturetotexture_title">Video capture to surface texture.</string>
|
||||
<string name="pref_capturetotexture_dlg">Capture video to textures (if available).</string>
|
||||
<string name="pref_capturetotexture_default">false</string>
|
||||
|
||||
<string name="pref_value_enabled">Enabled</string>
|
||||
<string name="pref_value_disabled">Disabled</string>
|
||||
|
||||
|
||||
@ -60,6 +60,12 @@
|
||||
android:title="@string/pref_hwcodec_title"
|
||||
android:dialogTitle="@string/pref_hwcodec_dlg"
|
||||
android:defaultValue="@string/pref_hwcodec_default" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/pref_capturetotexture_key"
|
||||
android:title="@string/pref_capturetotexture_title"
|
||||
android:dialogTitle="@string/pref_capturetotexture_dlg"
|
||||
android:defaultValue="@string/pref_capturetotexture_default" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@ -66,6 +66,8 @@ public class CallActivity extends Activity
|
||||
"org.appspot.apprtc.VIDEOCODEC";
|
||||
public static final String EXTRA_HWCODEC_ENABLED =
|
||||
"org.appspot.apprtc.HWCODEC";
|
||||
public static final String EXTRA_CAPTURETOTEXTURE_ENABLED =
|
||||
"org.appspot.apprtc.CAPTURETOTEXTURE";
|
||||
public static final String EXTRA_AUDIO_BITRATE =
|
||||
"org.appspot.apprtc.AUDIO_BITRATE";
|
||||
public static final String EXTRA_AUDIOCODEC =
|
||||
@ -220,6 +222,7 @@ public class CallActivity extends Activity
|
||||
intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0),
|
||||
intent.getStringExtra(EXTRA_VIDEOCODEC),
|
||||
intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
|
||||
intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false),
|
||||
intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0),
|
||||
intent.getStringExtra(EXTRA_AUDIOCODEC),
|
||||
intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false),
|
||||
|
||||
@ -65,6 +65,7 @@ public class ConnectActivity extends Activity {
|
||||
private String keyprefAudioBitrateValue;
|
||||
private String keyprefAudioCodec;
|
||||
private String keyprefHwCodecAcceleration;
|
||||
private String keyprefCaptureToTexture;
|
||||
private String keyprefNoAudioProcessingPipeline;
|
||||
private String keyprefOpenSLES;
|
||||
private String keyprefDisplayHud;
|
||||
@ -89,6 +90,7 @@ public class ConnectActivity extends Activity {
|
||||
keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_key);
|
||||
keyprefVideoCodec = getString(R.string.pref_videocodec_key);
|
||||
keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key);
|
||||
keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key);
|
||||
keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key);
|
||||
keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key);
|
||||
keyprefAudioCodec = getString(R.string.pref_audiocodec_key);
|
||||
@ -253,6 +255,10 @@ public class ConnectActivity extends Activity {
|
||||
boolean hwCodec = sharedPref.getBoolean(keyprefHwCodecAcceleration,
|
||||
Boolean.valueOf(getString(R.string.pref_hwcodec_default)));
|
||||
|
||||
// Check Capture to texture.
|
||||
boolean captureToTexture = sharedPref.getBoolean(keyprefCaptureToTexture,
|
||||
Boolean.valueOf(getString(R.string.pref_capturetotexture_default)));
|
||||
|
||||
// Check Disable Audio Processing flag.
|
||||
boolean noAudioProcessing = sharedPref.getBoolean(
|
||||
keyprefNoAudioProcessingPipeline,
|
||||
@ -339,6 +345,7 @@ public class ConnectActivity extends Activity {
|
||||
intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate);
|
||||
intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec);
|
||||
intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec);
|
||||
intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, captureToTexture);
|
||||
intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED,
|
||||
noAudioProcessing);
|
||||
intent.putExtra(CallActivity.EXTRA_OPENSLES_ENABLED, useOpenSLES);
|
||||
|
||||
@ -133,6 +133,7 @@ public class PeerConnectionClient {
|
||||
public final int videoStartBitrate;
|
||||
public final String videoCodec;
|
||||
public final boolean videoCodecHwAcceleration;
|
||||
public final boolean captureToTexture;
|
||||
public final int audioStartBitrate;
|
||||
public final String audioCodec;
|
||||
public final boolean noAudioProcessing;
|
||||
@ -141,7 +142,7 @@ public class PeerConnectionClient {
|
||||
public PeerConnectionParameters(
|
||||
boolean videoCallEnabled, boolean loopback,
|
||||
int videoWidth, int videoHeight, int videoFps, int videoStartBitrate,
|
||||
String videoCodec, boolean videoCodecHwAcceleration,
|
||||
String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTexture,
|
||||
int audioStartBitrate, String audioCodec,
|
||||
boolean noAudioProcessing, boolean useOpenSLES) {
|
||||
this.videoCallEnabled = videoCallEnabled;
|
||||
@ -152,6 +153,7 @@ public class PeerConnectionClient {
|
||||
this.videoStartBitrate = videoStartBitrate;
|
||||
this.videoCodec = videoCodec;
|
||||
this.videoCodecHwAcceleration = videoCodecHwAcceleration;
|
||||
this.captureToTexture = captureToTexture;
|
||||
this.audioStartBitrate = audioStartBitrate;
|
||||
this.audioCodec = audioCodec;
|
||||
this.noAudioProcessing = noAudioProcessing;
|
||||
@ -429,7 +431,7 @@ public class PeerConnectionClient {
|
||||
|
||||
if (videoCallEnabled) {
|
||||
Log.d(TAG, "EGLContext: " + renderEGLContext);
|
||||
factory.setVideoHwAccelerationOptions(renderEGLContext);
|
||||
factory.setVideoHwAccelerationOptions(renderEGLContext, renderEGLContext);
|
||||
}
|
||||
|
||||
PeerConnection.RTCConfiguration rtcConfig =
|
||||
@ -462,7 +464,8 @@ public class PeerConnectionClient {
|
||||
cameraDeviceName = frontCameraDeviceName;
|
||||
}
|
||||
Log.d(TAG, "Opening camera: " + cameraDeviceName);
|
||||
videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null);
|
||||
videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null,
|
||||
peerConnectionParameters.captureToTexture ? renderEGLContext : null);
|
||||
if (videoCapturer == null) {
|
||||
reportError("Failed to open camera");
|
||||
return;
|
||||
|
||||
@ -30,6 +30,7 @@ public class SettingsActivity extends Activity
|
||||
private String keyprefStartVideoBitrateValue;
|
||||
private String keyPrefVideoCodec;
|
||||
private String keyprefHwCodec;
|
||||
private String keyprefCaptureToTexture;
|
||||
|
||||
private String keyprefStartAudioBitrateType;
|
||||
private String keyprefStartAudioBitrateValue;
|
||||
@ -51,6 +52,7 @@ public class SettingsActivity extends Activity
|
||||
keyprefStartVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_key);
|
||||
keyPrefVideoCodec = getString(R.string.pref_videocodec_key);
|
||||
keyprefHwCodec = getString(R.string.pref_hwcodec_key);
|
||||
keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key);
|
||||
|
||||
keyprefStartAudioBitrateType = getString(R.string.pref_startaudiobitrate_key);
|
||||
keyprefStartAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key);
|
||||
@ -84,6 +86,7 @@ public class SettingsActivity extends Activity
|
||||
setVideoBitrateEnable(sharedPreferences);
|
||||
updateSummary(sharedPreferences, keyPrefVideoCodec);
|
||||
updateSummaryB(sharedPreferences, keyprefHwCodec);
|
||||
updateSummaryB(sharedPreferences, keyprefCaptureToTexture);
|
||||
|
||||
updateSummary(sharedPreferences, keyprefStartAudioBitrateType);
|
||||
updateSummaryBitrate(sharedPreferences, keyprefStartAudioBitrateValue);
|
||||
@ -121,6 +124,7 @@ public class SettingsActivity extends Activity
|
||||
} else if (key.equals(keyprefVideoCall)
|
||||
|| key.equals(keyprefCaptureQualitySlider)
|
||||
|| key.equals(keyprefHwCodec)
|
||||
|| key.equals(keyprefCaptureToTexture)
|
||||
|| key.equals(keyprefNoAudioProcessing)
|
||||
|| key.equals(keyprefOpenSLES)
|
||||
|| key.equals(keyPrefDisplayHud)) {
|
||||
|
||||
@ -250,7 +250,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
|
||||
PeerConnectionParameters peerConnectionParameters =
|
||||
new PeerConnectionParameters(
|
||||
enableVideo, true, // videoCallEnabled, loopback.
|
||||
0, 0, 0, 0, videoCodec, true, // video codec parameters.
|
||||
0, 0, 0, 0, videoCodec, true, false, // video codec parameters.
|
||||
0, "OPUS", false, false); // audio codec parameters.
|
||||
return peerConnectionParameters;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user