Index: talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java |
diff --git a/talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java b/talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java |
index 95cceffa3d17bba113336f3e5f0c9fe0ffcdaf8d..fe3300c85f6dfdce1f1a11ca615ed2a3145e9b48 100644 |
--- a/talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java |
+++ b/talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java |
@@ -36,10 +36,11 @@ import android.opengl.Matrix; |
import android.os.Handler; |
import android.os.HandlerThread; |
import android.util.AttributeSet; |
-import android.util.Log; |
import android.view.SurfaceHolder; |
import android.view.SurfaceView; |
+import org.webrtc.Logging; |
+ |
/** |
* Implements org.webrtc.VideoRenderer.Callbacks by displaying the video stream on a SurfaceView. |
* renderFrame() is asynchronous to avoid blocking the calling thread. |
@@ -144,7 +145,7 @@ public class SurfaceViewRenderer extends SurfaceView |
if (renderThreadHandler != null) { |
throw new IllegalStateException("Already initialized"); |
} |
- Log.d(TAG, "Initializing"); |
+ Logging.d(TAG, "Initializing"); |
this.rendererEvents = rendererEvents; |
renderThread = new HandlerThread(TAG); |
renderThread.start(); |
@@ -161,7 +162,7 @@ public class SurfaceViewRenderer extends SurfaceView |
public void release() { |
synchronized (threadLock) { |
if (renderThreadHandler == null) { |
- Log.d(TAG, "Already released"); |
+ Logging.d(TAG, "Already released"); |
return; |
} |
// Release EGL and GL resources on render thread. |
@@ -221,7 +222,7 @@ public class SurfaceViewRenderer extends SurfaceView |
} |
synchronized (threadLock) { |
if (renderThreadHandler == null) { |
- Log.d(TAG, "Dropping frame - SurfaceViewRenderer not initialized or already released."); |
+ Logging.d(TAG, "Dropping frame - SurfaceViewRenderer not initialized or already released."); |
} else { |
synchronized (frameLock) { |
if (pendingFrame == null) { |
@@ -281,7 +282,7 @@ public class SurfaceViewRenderer extends SurfaceView |
// SurfaceHolder.Callback interface. |
@Override |
public void surfaceCreated(final SurfaceHolder holder) { |
- Log.d(TAG, "Surface created"); |
+ Logging.d(TAG, "Surface created"); |
runOnRenderThread(new Runnable() { |
@Override public void run() { |
eglBase.createSurface(holder.getSurface()); |
@@ -294,7 +295,7 @@ public class SurfaceViewRenderer extends SurfaceView |
@Override |
public void surfaceDestroyed(SurfaceHolder holder) { |
- Log.d(TAG, "Surface destroyed"); |
+ Logging.d(TAG, "Surface destroyed"); |
synchronized (layoutLock) { |
surfaceWidth = 0; |
surfaceHeight = 0; |
@@ -308,7 +309,7 @@ public class SurfaceViewRenderer extends SurfaceView |
@Override |
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { |
- Log.d(TAG, "Surface changed: " + width + "x" + height); |
+ Logging.d(TAG, "Surface changed: " + width + "x" + height); |
synchronized (layoutLock) { |
surfaceWidth = width; |
surfaceHeight = height; |
@@ -335,7 +336,7 @@ public class SurfaceViewRenderer extends SurfaceView |
synchronized (layoutLock) { |
final Point desiredLayoutSize = getDesiredLayoutSize(); |
if (desiredLayoutSize.x != layoutWidth || desiredLayoutSize.y != layoutHeight) { |
- Log.d(TAG, "Requesting new layout with size: " |
+ Logging.d(TAG, "Requesting new layout with size: " |
+ desiredLayoutSize.x + "x" + desiredLayoutSize.y); |
// Request layout update on UI thread. |
post(new Runnable() { |
@@ -356,7 +357,7 @@ public class SurfaceViewRenderer extends SurfaceView |
*/ |
private void renderFrameOnRenderThread() { |
if (eglBase == null || !eglBase.hasSurface()) { |
- Log.d(TAG, "No surface to draw on"); |
+ Logging.d(TAG, "No surface to draw on"); |
return; |
} |
if (!checkConsistentLayout()) { |
@@ -449,10 +450,10 @@ public class SurfaceViewRenderer extends SurfaceView |
if (rendererEvents != null) { |
final String id = getResources().getResourceEntryName(getId()); |
if (frameWidth == 0 || frameHeight == 0) { |
- Log.d(TAG, "ID: " + id + ". Reporting first rendered frame."); |
+ Logging.d(TAG, "ID: " + id + ". Reporting first rendered frame."); |
rendererEvents.onFirstFrameRendered(); |
} |
- Log.d(TAG, "ID: " + id + ". Reporting frame resolution changed to " |
+ Logging.d(TAG, "ID: " + id + ". Reporting frame resolution changed to " |
+ frame.width + "x" + frame.height + " with rotation " + frame.rotationDegree); |
rendererEvents.onFrameResolutionChanged(frame.width, frame.height, frame.rotationDegree); |
} |
@@ -465,13 +466,13 @@ public class SurfaceViewRenderer extends SurfaceView |
private void logStatistics() { |
synchronized (statisticsLock) { |
- Log.d(TAG, "ID: " + getResources().getResourceEntryName(getId()) + ". Frames received: " |
+ Logging.d(TAG, "ID: " + getResources().getResourceEntryName(getId()) + ". Frames received: " |
+ framesReceived + ". Dropped: " + framesDropped + ". Rendered: " + framesRendered); |
if (framesReceived > 0 && framesRendered > 0) { |
final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
- Log.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + |
+ Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + |
" ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs); |
- Log.d(TAG, "Average render time: " |
+ Logging.d(TAG, "Average render time: " |
+ (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
} |
} |