Implement standalone event tracing in AppRTCDemo.
Logs tracing events (TRACE_EVENT0 and friends) to storage in a format compatible with chrome://tracing which can be used for performance evaluation, finding lock contention and other sweet things). Tracing is still basic and doesn't contain thread metadata or logging of tracing arguments. BUG=webrtc:5158 R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1457383002 . Cr-Commit-Position: refs/heads/master@{#10921}
This commit is contained in:
@ -78,6 +78,7 @@ public class CallActivity extends Activity
|
||||
"org.appspot.apprtc.OPENSLES";
|
||||
public static final String EXTRA_DISPLAY_HUD =
|
||||
"org.appspot.apprtc.DISPLAY_HUD";
|
||||
public static final String EXTRA_TRACING = "org.appspot.apprtc.TRACING";
|
||||
public static final String EXTRA_CMDLINE =
|
||||
"org.appspot.apprtc.CMDLINE";
|
||||
public static final String EXTRA_RUNTIME =
|
||||
@ -213,9 +214,11 @@ public class CallActivity extends Activity
|
||||
return;
|
||||
}
|
||||
boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
|
||||
boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
|
||||
peerConnectionParameters = new PeerConnectionParameters(
|
||||
intent.getBooleanExtra(EXTRA_VIDEO_CALL, true),
|
||||
loopback,
|
||||
tracing,
|
||||
intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0),
|
||||
intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0),
|
||||
intent.getIntExtra(EXTRA_VIDEO_FPS, 0),
|
||||
|
||||
@ -69,6 +69,7 @@ public class ConnectActivity extends Activity {
|
||||
private String keyprefNoAudioProcessingPipeline;
|
||||
private String keyprefOpenSLES;
|
||||
private String keyprefDisplayHud;
|
||||
private String keyprefTracing;
|
||||
private String keyprefRoomServerUrl;
|
||||
private String keyprefRoom;
|
||||
private String keyprefRoomList;
|
||||
@ -97,6 +98,7 @@ public class ConnectActivity extends Activity {
|
||||
keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing_key);
|
||||
keyprefOpenSLES = getString(R.string.pref_opensles_key);
|
||||
keyprefDisplayHud = getString(R.string.pref_displayhud_key);
|
||||
keyprefTracing = getString(R.string.pref_tracing_key);
|
||||
keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key);
|
||||
keyprefRoom = getString(R.string.pref_room_key);
|
||||
keyprefRoomList = getString(R.string.pref_room_list_key);
|
||||
@ -328,6 +330,9 @@ public class ConnectActivity extends Activity {
|
||||
boolean displayHud = sharedPref.getBoolean(keyprefDisplayHud,
|
||||
Boolean.valueOf(getString(R.string.pref_displayhud_default)));
|
||||
|
||||
boolean tracing = sharedPref.getBoolean(
|
||||
keyprefTracing, Boolean.valueOf(getString(R.string.pref_tracing_default)));
|
||||
|
||||
// Start AppRTCDemo activity.
|
||||
Log.d(TAG, "Connecting to room " + roomId + " at URL " + roomUrl);
|
||||
if (validateUrl(roomUrl)) {
|
||||
@ -352,6 +357,7 @@ public class ConnectActivity extends Activity {
|
||||
intent.putExtra(CallActivity.EXTRA_AUDIO_BITRATE, audioStartBitrate);
|
||||
intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, audioCodec);
|
||||
intent.putExtra(CallActivity.EXTRA_DISPLAY_HUD, displayHud);
|
||||
intent.putExtra(CallActivity.EXTRA_TRACING, tracing);
|
||||
intent.putExtra(CallActivity.EXTRA_CMDLINE, commandLineRun);
|
||||
intent.putExtra(CallActivity.EXTRA_RUNTIME, runTimeMs);
|
||||
|
||||
|
||||
@ -128,6 +128,7 @@ public class PeerConnectionClient {
|
||||
public static class PeerConnectionParameters {
|
||||
public final boolean videoCallEnabled;
|
||||
public final boolean loopback;
|
||||
public final boolean tracing;
|
||||
public final int videoWidth;
|
||||
public final int videoHeight;
|
||||
public final int videoFps;
|
||||
@ -141,13 +142,14 @@ public class PeerConnectionClient {
|
||||
public final boolean useOpenSLES;
|
||||
|
||||
public PeerConnectionParameters(
|
||||
boolean videoCallEnabled, boolean loopback,
|
||||
boolean videoCallEnabled, boolean loopback, boolean tracing,
|
||||
int videoWidth, int videoHeight, int videoFps, int videoStartBitrate,
|
||||
String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTexture,
|
||||
int audioStartBitrate, String audioCodec,
|
||||
boolean noAudioProcessing, boolean useOpenSLES) {
|
||||
this.videoCallEnabled = videoCallEnabled;
|
||||
this.loopback = loopback;
|
||||
this.tracing = tracing;
|
||||
this.videoWidth = videoWidth;
|
||||
this.videoHeight = videoHeight;
|
||||
this.videoFps = videoFps;
|
||||
@ -285,6 +287,10 @@ public class PeerConnectionClient {
|
||||
}
|
||||
|
||||
private void createPeerConnectionFactoryInternal(Context context) {
|
||||
PeerConnectionFactory.initializeInternalTracer();
|
||||
if (peerConnectionParameters.tracing) {
|
||||
PeerConnectionFactory.startInternalTracingCapture("/mnt/sdcard/webrtc-trace.txt");
|
||||
}
|
||||
Log.d(TAG, "Create peer connection factory. Use video: " +
|
||||
peerConnectionParameters.videoCallEnabled);
|
||||
isError = false;
|
||||
@ -502,6 +508,8 @@ public class PeerConnectionClient {
|
||||
options = null;
|
||||
Log.d(TAG, "Closing peer connection done.");
|
||||
events.onPeerConnectionClosed();
|
||||
PeerConnectionFactory.stopInternalTracingCapture();
|
||||
PeerConnectionFactory.shutdownInternalTracer();
|
||||
}
|
||||
|
||||
public boolean isHDVideo() {
|
||||
|
||||
@ -40,6 +40,7 @@ public class SettingsActivity extends Activity
|
||||
|
||||
private String keyPrefRoomServerUrl;
|
||||
private String keyPrefDisplayHud;
|
||||
private String keyPrefTracing;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -62,6 +63,7 @@ public class SettingsActivity extends Activity
|
||||
|
||||
keyPrefRoomServerUrl = getString(R.string.pref_room_server_url_key);
|
||||
keyPrefDisplayHud = getString(R.string.pref_displayhud_key);
|
||||
keyPrefTracing = getString(R.string.pref_tracing_key);
|
||||
|
||||
// Display the fragment as the main content.
|
||||
settingsFragment = new SettingsFragment();
|
||||
@ -97,6 +99,7 @@ public class SettingsActivity extends Activity
|
||||
|
||||
updateSummary(sharedPreferences, keyPrefRoomServerUrl);
|
||||
updateSummaryB(sharedPreferences, keyPrefDisplayHud);
|
||||
updateSummaryB(sharedPreferences, keyPrefTracing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,6 +125,7 @@ public class SettingsActivity extends Activity
|
||||
|| key.equals(keyprefStartAudioBitrateValue)) {
|
||||
updateSummaryBitrate(sharedPreferences, key);
|
||||
} else if (key.equals(keyprefVideoCall)
|
||||
|| key.equals(keyPrefTracing)
|
||||
|| key.equals(keyprefCaptureQualitySlider)
|
||||
|| key.equals(keyprefHwCodec)
|
||||
|| key.equals(keyprefCaptureToTexture)
|
||||
|
||||
Reference in New Issue
Block a user