Log to webrtc logging stream from java code.
Future log messages should all be sent to org.webrtc.Logging as well.

BUG=

Committed: https://crrev.com/66f0da2197974dcc1008f25df2bb4e1d463ad506
Cr-Commit-Position: refs/heads/master@{#9936}

R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1338033003 .

Cr-Commit-Position: refs/heads/master@{#9957}
diff --git a/talk/app/webrtc/java/android/org/webrtc/Camera2Enumerator.java b/talk/app/webrtc/java/android/org/webrtc/Camera2Enumerator.java
index ae164cb..097d1cd 100644
--- a/talk/app/webrtc/java/android/org/webrtc/Camera2Enumerator.java
+++ b/talk/app/webrtc/java/android/org/webrtc/Camera2Enumerator.java
@@ -34,11 +34,11 @@
 import android.hardware.camera2.params.StreamConfigurationMap;
 import android.os.Build;
 import android.os.SystemClock;
-import android.util.Log;
 import android.util.Range;
 import android.util.Size;
 
 import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
+import org.webrtc.Logging;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -69,14 +69,14 @@
       if (cachedSupportedFormats.containsKey(cameraId)) {
         return cachedSupportedFormats.get(cameraId);
       }
-      Log.d(TAG, "Get supported formats for camera index " + cameraId + ".");
+      Logging.d(TAG, "Get supported formats for camera index " + cameraId + ".");
       final long startTimeMs = SystemClock.elapsedRealtime();
 
       final CameraCharacteristics cameraCharacteristics;
       try {
         cameraCharacteristics = cameraManager.getCameraCharacteristics(Integer.toString(cameraId));
       } catch (Exception ex) {
-        Log.e(TAG, "getCameraCharacteristics(): " + ex);
+        Logging.e(TAG, "getCameraCharacteristics(): " + ex);
         return new ArrayList<CaptureFormat>();
       }
 
@@ -111,7 +111,7 @@
       }
       cachedSupportedFormats.put(cameraId, formatList);
       final long endTimeMs = SystemClock.elapsedRealtime();
-      Log.d(TAG, "Get supported formats for camera index " + cameraId + " done."
+      Logging.d(TAG, "Get supported formats for camera index " + cameraId + " done."
           + " Time spent: " + (endTimeMs - startTimeMs) + " ms.");
       return formatList;
     }
diff --git a/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java b/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java
index c8f9a30..3e37f6a 100644
--- a/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java
+++ b/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java
@@ -30,13 +30,14 @@
 import static java.lang.Math.abs;
 import static java.lang.Math.ceil;
 import android.hardware.Camera;
-import android.util.Log;
 import android.graphics.ImageFormat;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import org.webrtc.Logging;
+
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -145,7 +146,7 @@
     try {
       Camera.getCameraInfo(index, info);
     } catch (Exception e) {
-      Log.e(TAG, "getCameraInfo failed on index " + index,e);
+      Logging.e(TAG, "getCameraInfo failed on index " + index,e);
       return null;
     }
 
@@ -177,7 +178,7 @@
       json_format.put("framerate", (format.maxFramerate + 999) / 1000);
       json_formats.put(json_format);
     }
-    Log.d(TAG, "Supported formats for camera " + id + ": "
+    Logging.d(TAG, "Supported formats for camera " + id + ": "
         +  json_formats.toString(2));
     return json_formats.toString();
   }
@@ -196,7 +197,7 @@
   public static int[] getFramerateRange(Camera.Parameters parameters, final int framerate) {
     List<int[]> listFpsRange = parameters.getSupportedPreviewFpsRange();
     if (listFpsRange.isEmpty()) {
-      Log.w(TAG, "No supported preview fps range");
+      Logging.w(TAG, "No supported preview fps range");
       return new int[]{0, 0};
     }
     return Collections.min(listFpsRange,
@@ -227,7 +228,7 @@
           return getDeviceName(i);
         }
       } catch (Exception e) {
-        Log.e(TAG, "getCameraInfo() failed on index " + i, e);
+        Logging.e(TAG, "getCameraInfo() failed on index " + i, e);
       }
     }
     return null;
diff --git a/talk/app/webrtc/java/android/org/webrtc/CameraEnumerator.java b/talk/app/webrtc/java/android/org/webrtc/CameraEnumerator.java
index 0e6b978..2f35dc3 100644
--- a/talk/app/webrtc/java/android/org/webrtc/CameraEnumerator.java
+++ b/talk/app/webrtc/java/android/org/webrtc/CameraEnumerator.java
@@ -29,9 +29,9 @@
 
 import android.hardware.Camera;
 import android.os.SystemClock;
-import android.util.Log;
 
 import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
+import org.webrtc.Logging;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -58,16 +58,16 @@
   }
 
   private List<CaptureFormat> enumerateFormats(int cameraId) {
-    Log.d(TAG, "Get supported formats for camera index " + cameraId + ".");
+    Logging.d(TAG, "Get supported formats for camera index " + cameraId + ".");
     final long startTimeMs = SystemClock.elapsedRealtime();
     final Camera.Parameters parameters;
     Camera camera = null;
     try {
-      Log.d(TAG, "Opening camera with index " + cameraId);
+      Logging.d(TAG, "Opening camera with index " + cameraId);
       camera = Camera.open(cameraId);
       parameters = camera.getParameters();
     } catch (RuntimeException e) {
-      Log.e(TAG, "Open camera failed on camera index " + cameraId, e);
+      Logging.e(TAG, "Open camera failed on camera index " + cameraId, e);
       return new ArrayList<CaptureFormat>();
     } finally {
       if (camera != null) {
@@ -91,11 +91,11 @@
         formatList.add(new CaptureFormat(size.width, size.height, minFps, maxFps));
       }
     } catch (Exception e) {
-      Log.e(TAG, "getSupportedFormats() failed on camera index " + cameraId, e);
+      Logging.e(TAG, "getSupportedFormats() failed on camera index " + cameraId, e);
     }
 
     final long endTimeMs = SystemClock.elapsedRealtime();
-    Log.d(TAG, "Get supported formats for camera index " + cameraId + " done."
+    Logging.d(TAG, "Get supported formats for camera index " + cameraId + " done."
         + " Time spent: " + (endTimeMs - startTimeMs) + " ms.");
     return formatList;
   }
diff --git a/talk/app/webrtc/java/android/org/webrtc/EglBase.java b/talk/app/webrtc/java/android/org/webrtc/EglBase.java
index 20af8ec..2aa2807 100644
--- a/talk/app/webrtc/java/android/org/webrtc/EglBase.java
+++ b/talk/app/webrtc/java/android/org/webrtc/EglBase.java
@@ -32,9 +32,10 @@
 import android.opengl.EGLContext;
 import android.opengl.EGLDisplay;
 import android.opengl.EGLSurface;
-import android.util.Log;
 import android.view.Surface;
 
+import org.webrtc.Logging;
+
 /**
  * Holds EGL state and utility methods for handling an EGLContext, an EGLDisplay, and an EGLSurface.
  */
@@ -52,7 +53,7 @@
   private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE;
 
   public static boolean isEGL14Supported() {
-    Log.d(TAG, "SDK version: " + CURRENT_SDK_VERSION);
+    Logging.d(TAG, "SDK version: " + CURRENT_SDK_VERSION);
     return (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION);
   }
 
@@ -86,7 +87,7 @@
   public void createSurface(Surface surface) {
     checkIsNotReleased();
     if (configType == ConfigType.PIXEL_BUFFER) {
-      Log.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface");
+      Logging.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface");
     }
     if (eglSurface != EGL14.EGL_NO_SURFACE) {
       throw new RuntimeException("Already has an EGLSurface");
diff --git a/talk/app/webrtc/java/android/org/webrtc/GlShader.java b/talk/app/webrtc/java/android/org/webrtc/GlShader.java
index 3014aab..966f0f5 100644
--- a/talk/app/webrtc/java/android/org/webrtc/GlShader.java
+++ b/talk/app/webrtc/java/android/org/webrtc/GlShader.java
@@ -28,7 +28,8 @@
 package org.webrtc;
 
 import android.opengl.GLES20;
-import android.util.Log;
+
+import org.webrtc.Logging;
 
 import java.nio.FloatBuffer;
 
@@ -45,7 +46,7 @@
     GLES20.glCompileShader(shader);
     GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, result, 0);
     if (result[0] != GLES20.GL_TRUE) {
-      Log.e(TAG, "Could not compile shader " + shaderType + ":" +
+      Logging.e(TAG, "Could not compile shader " + shaderType + ":" +
           GLES20.glGetShaderInfoLog(shader));
       throw new RuntimeException(GLES20.glGetShaderInfoLog(shader));
     }
@@ -72,7 +73,7 @@
     };
     GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
     if (linkStatus[0] != GLES20.GL_TRUE) {
-      Log.e(TAG, "Could not link program: " +
+      Logging.e(TAG, "Could not link program: " +
           GLES20.glGetProgramInfoLog(program));
       throw new RuntimeException(GLES20.glGetProgramInfoLog(program));
     }
@@ -124,7 +125,7 @@
   }
 
   public void release() {
-    Log.d(TAG, "Deleting shader.");
+    Logging.d(TAG, "Deleting shader.");
     // Flag shaders for deletion (does not delete until no longer attached to a program).
     if (vertexShader != -1) {
       GLES20.glDeleteShader(vertexShader);
diff --git a/talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java b/talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java
index 95cceff..fe3300c 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.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 @@
     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 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 @@
     }
     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 @@
   // 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 @@
 
   @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 @@
 
   @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 @@
     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 @@
    */
   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 @@
         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 @@
 
   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.");
       }
     }
diff --git a/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java b/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
index dc3f8e8..c88f1c5 100644
--- a/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
+++ b/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
@@ -36,12 +36,12 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.SystemClock;
-import android.util.Log;
 import android.view.Surface;
 import android.view.WindowManager;
 
 import org.json.JSONException;
 import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
+import org.webrtc.Logging;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -105,7 +105,7 @@
       } else {
         errorMessage = "Camera error: " + error;
       }
-      Log.e(TAG, errorMessage);
+      Logging.e(TAG, errorMessage);
       if (errorHandler != null) {
         errorHandler.onCameraError(errorMessage);
       }
@@ -124,11 +124,11 @@
         averageCaptureBuffersCount =
             (double)captureBuffersCount / cameraFramesCount;
       }
-      Log.d(TAG, "Camera fps: " + cameraFps + ". CaptureBuffers: " +
+      Logging.d(TAG, "Camera fps: " + cameraFps + ". CaptureBuffers: " +
           String.format("%.1f", averageCaptureBuffersCount) +
           ". Pending buffers: " + videoBuffers.pendingFramesTimeStamps());
       if (cameraFramesCount == 0) {
-        Log.e(TAG, "Camera freezed.");
+        Logging.e(TAG, "Camera freezed.");
         if (errorHandler != null) {
           errorHandler.onCameraError("Camera failure.");
         }
@@ -168,13 +168,13 @@
       return false;
 
     if (cameraThreadHandler == null) {
-        Log.e(TAG, "Calling switchCamera() for stopped camera.");
+        Logging.e(TAG, "Calling switchCamera() for stopped camera.");
         return false;
     }
     if (pendingCameraSwitch) {
       // Do not handle multiple camera switch request to avoid blocking
       // camera thread by handling too many switch request from a queue.
-      Log.w(TAG, "Ignoring camera switch request.");
+      Logging.w(TAG, "Ignoring camera switch request.");
       return false;
     }
 
@@ -193,7 +193,7 @@
   public synchronized void onOutputFormatRequest(
       final int width, final int height, final int fps) {
     if (cameraThreadHandler == null) {
-      Log.e(TAG, "Calling onOutputFormatRequest() for already stopped camera.");
+      Logging.e(TAG, "Calling onOutputFormatRequest() for already stopped camera.");
       return;
     }
     cameraThreadHandler.post(new Runnable() {
@@ -208,7 +208,7 @@
   public synchronized void changeCaptureFormat(
       final int width, final int height, final int framerate) {
     if (cameraThreadHandler == null) {
-      Log.e(TAG, "Calling changeCaptureFormat() for already stopped camera.");
+      Logging.e(TAG, "Calling changeCaptureFormat() for already stopped camera.");
       return;
     }
     cameraThreadHandler.post(new Runnable() {
@@ -229,14 +229,14 @@
   }
 
   private VideoCapturerAndroid() {
-    Log.d(TAG, "VideoCapturerAndroid");
+    Logging.d(TAG, "VideoCapturerAndroid");
   }
 
   // Called by native code.
   // Initializes local variables for the camera named |deviceName|. If |deviceName| is empty, the
   // first available device is used in order to be compatible with the generic VideoCapturer class.
   synchronized boolean init(String deviceName) {
-    Log.d(TAG, "init: " + deviceName);
+    Logging.d(TAG, "init: " + deviceName);
     if (deviceName == null)
       return false;
 
@@ -281,7 +281,7 @@
   synchronized void startCapture(
       final int width, final int height, final int framerate,
       final Context applicationContext, final CapturerObserver frameObserver) {
-    Log.d(TAG, "startCapture requested: " + width + "x" + height
+    Logging.d(TAG, "startCapture requested: " + width + "x" + height
         + "@" + framerate);
     if (applicationContext == null) {
       throw new RuntimeException("applicationContext not set.");
@@ -312,7 +312,7 @@
     this.applicationContext = applicationContext;
     this.frameObserver = frameObserver;
     try {
-      Log.d(TAG, "Opening camera " + id);
+      Logging.d(TAG, "Opening camera " + id);
       camera = Camera.open(id);
       info = new Camera.CameraInfo();
       Camera.getCameraInfo(id, info);
@@ -328,11 +328,11 @@
 
         camera.setPreviewTexture(cameraSurfaceTexture);
       } catch (IOException e) {
-        Log.e(TAG, "setPreviewTexture failed", error);
+        Logging.e(TAG, "setPreviewTexture failed", error);
         throw new RuntimeException(e);
       }
 
-      Log.d(TAG, "Camera orientation: " + info.orientation +
+      Logging.d(TAG, "Camera orientation: " + info.orientation +
           " .Device orientation: " + getDeviceOrientation());
       camera.setErrorCallback(cameraErrorCallback);
       startPreviewOnCameraThread(width, height, framerate);
@@ -346,7 +346,7 @@
     } catch (RuntimeException e) {
       error = e;
     }
-    Log.e(TAG, "startCapture failed", error);
+    Logging.e(TAG, "startCapture failed", error);
     stopCaptureOnCameraThread();
     cameraThreadHandler = null;
     frameObserver.OnCapturerStarted(false);
@@ -358,10 +358,10 @@
 
   // (Re)start preview with the closest supported format to |width| x |height| @ |framerate|.
   private void startPreviewOnCameraThread(int width, int height, int framerate) {
-    Log.d(
+    Logging.d(
         TAG, "startPreviewOnCameraThread requested: " + width + "x" + height + "@" + framerate);
     if (camera == null) {
-      Log.e(TAG, "Calling startPreviewOnCameraThread on stopped camera.");
+      Logging.e(TAG, "Calling startPreviewOnCameraThread on stopped camera.");
       return;
     }
 
@@ -385,7 +385,7 @@
     }
 
     // Update camera parameters.
-    Log.d(TAG, "isVideoStabilizationSupported: " +
+    Logging.d(TAG, "isVideoStabilizationSupported: " +
         parameters.isVideoStabilizationSupported());
     if (parameters.isVideoStabilizationSupported()) {
       parameters.setVideoStabilization(true);
@@ -412,7 +412,7 @@
     }
 
     // (Re)start preview.
-    Log.d(TAG, "Start capturing: " + captureFormat);
+    Logging.d(TAG, "Start capturing: " + captureFormat);
     this.captureFormat = captureFormat;
     camera.setParameters(parameters);
     videoBuffers.queueCameraBuffers(captureFormat.frameSize(), camera);
@@ -423,10 +423,10 @@
   // Called by native code.  Returns true when camera is known to be stopped.
   synchronized void stopCapture() throws InterruptedException {
     if (cameraThreadHandler == null) {
-      Log.e(TAG, "Calling stopCapture() for already stopped camera.");
+      Logging.e(TAG, "Calling stopCapture() for already stopped camera.");
       return;
     }
-    Log.d(TAG, "stopCapture");
+    Logging.d(TAG, "stopCapture");
     cameraThreadHandler.post(new Runnable() {
         @Override public void run() {
           stopCaptureOnCameraThread();
@@ -434,7 +434,7 @@
     });
     cameraThread.join();
     cameraThreadHandler = null;
-    Log.d(TAG, "stopCapture done");
+    Logging.d(TAG, "stopCapture done");
   }
 
   private void stopCaptureOnCameraThread() {
@@ -444,13 +444,13 @@
   }
 
   private void doStopCaptureOnCameraThread() {
-    Log.d(TAG, "stopCaptureOnCameraThread");
+    Logging.d(TAG, "stopCaptureOnCameraThread");
     if (camera == null) {
       return;
     }
     try {
       cameraThreadHandler.removeCallbacks(cameraObserver);
-      Log.d(TAG, "Stop preview.");
+      Logging.d(TAG, "Stop preview.");
       camera.stopPreview();
       camera.setPreviewCallbackWithBuffer(null);
       videoBuffers.stopReturnBuffersToCamera();
@@ -462,22 +462,22 @@
         GLES20.glDeleteTextures(1, new int[] {cameraGlTexture}, 0);
         cameraGlTexture = 0;
       }
-      Log.d(TAG, "Release camera.");
+      Logging.d(TAG, "Release camera.");
       camera.release();
       camera = null;
     } catch (IOException e) {
-      Log.e(TAG, "Failed to stop camera", e);
+      Logging.e(TAG, "Failed to stop camera", e);
     }
   }
 
   private void switchCameraOnCameraThread(Runnable switchDoneEvent) {
-    Log.d(TAG, "switchCameraOnCameraThread");
+    Logging.d(TAG, "switchCameraOnCameraThread");
 
     doStopCaptureOnCameraThread();
     startCaptureOnCameraThread(requestedWidth, requestedHeight, requestedFramerate, frameObserver,
         applicationContext);
     pendingCameraSwitch = false;
-    Log.d(TAG, "switchCameraOnCameraThread done");
+    Logging.d(TAG, "switchCameraOnCameraThread done");
     if (switchDoneEvent != null) {
       switchDoneEvent.run();
     }
@@ -488,7 +488,7 @@
     if (camera == null) {
       return;
     }
-    Log.d(TAG, "onOutputFormatRequestOnCameraThread: " + width + "x" + height +
+    Logging.d(TAG, "onOutputFormatRequestOnCameraThread: " + width + "x" + height +
         "@" + fps);
     frameObserver.OnOutputFormatRequest(width, height, fps);
   }
@@ -550,7 +550,7 @@
       frameObserver.OnFrameCaptured(data, videoBuffers.frameSize, captureFormat.width,
           captureFormat.height, rotation, captureTimeNs);
     } else {
-      Log.w(TAG, "reserveByteBuffer failed - dropping frame.");
+      Logging.w(TAG, "reserveByteBuffer failed - dropping frame.");
     }
   }
 
@@ -613,7 +613,7 @@
         camera.addCallbackBuffer(buffer.array());
         queuedBuffers.put(buffer.array(), buffer);
       }
-      Log.d(TAG, "queueCameraBuffers enqueued " + numCaptureBuffers
+      Logging.d(TAG, "queueCameraBuffers enqueued " + numCaptureBuffers
           + " buffers of size " + frameSize + ".");
     }
 
@@ -629,7 +629,7 @@
       this.camera = null;
       queuedBuffers.clear();
       // Frames in |pendingBuffers| need to be kept alive until they are returned.
-      Log.d(TAG, "stopReturnBuffersToCamera called."
+      Logging.d(TAG, "stopReturnBuffersToCamera called."
             + (pendingBuffers.isEmpty() ?
                    " All buffers have been returned."
                    : " Pending buffers: " + pendingFramesTimeStamps() + "."));
@@ -640,7 +640,7 @@
       if (buffer == null) {
         // Frames might be posted to |onPreviewFrame| with the previous format while changing
         // capture format in |startPreviewOnCameraThread|. Drop these old frames.
-        Log.w(TAG, "Received callback buffer from previous configuration with length: "
+        Logging.w(TAG, "Received callback buffer from previous configuration with length: "
             + (data == null ? "null" : data.length));
         return false;
       }
@@ -648,12 +648,12 @@
         throw new IllegalStateException("Callback buffer has unexpected frame size");
       }
       if (pendingBuffers.containsKey(timeStamp)) {
-        Log.e(TAG, "Timestamp already present in pending buffers - they need to be unique");
+        Logging.e(TAG, "Timestamp already present in pending buffers - they need to be unique");
         return false;
       }
       pendingBuffers.put(timeStamp, buffer);
       if (queuedBuffers.isEmpty()) {
-        Log.v(TAG, "Camera is running out of capture buffers."
+        Logging.v(TAG, "Camera is running out of capture buffers."
             + " Pending buffers: " + pendingFramesTimeStamps());
       }
       return true;
@@ -669,7 +669,7 @@
       if (camera != null && returnedFrame.capacity() == frameSize) {
         camera.addCallbackBuffer(returnedFrame.array());
         if (queuedBuffers.isEmpty()) {
-          Log.v(TAG, "Frame returned when camera is running out of capture"
+          Logging.v(TAG, "Frame returned when camera is running out of capture"
               + " buffers for TS " + TimeUnit.NANOSECONDS.toMillis(timeStamp));
         }
         queuedBuffers.put(returnedFrame.array(), returnedFrame);
@@ -677,7 +677,7 @@
       }
 
       if (returnedFrame.capacity() != frameSize) {
-        Log.d(TAG, "returnBuffer with time stamp "
+        Logging.d(TAG, "returnBuffer with time stamp "
             + TimeUnit.NANOSECONDS.toMillis(timeStamp)
             + " called with old frame size, " + returnedFrame.capacity() + ".");
         // Since this frame has the wrong size, don't requeue it. Frames with the correct size are
@@ -685,7 +685,7 @@
         return;
       }
 
-      Log.d(TAG, "returnBuffer with time stamp "
+      Logging.d(TAG, "returnBuffer with time stamp "
           + TimeUnit.NANOSECONDS.toMillis(timeStamp)
           + " called after camera has been stopped.");
     }
diff --git a/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java b/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
index 3072613..9909bff 100644
--- a/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
+++ b/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
@@ -44,6 +44,7 @@
 import android.opengl.Matrix;
 import android.util.Log;
 
+import org.webrtc.Logging;
 import org.webrtc.VideoRenderer.I420Frame;
 
 /**
@@ -158,7 +159,7 @@
         GLSurfaceView surface, int id,
         int x, int y, int width, int height,
         RendererCommon.ScalingType scalingType, boolean mirror) {
-      Log.d(TAG, "YuvImageRenderer.Create id: " + id);
+      Logging.d(TAG, "YuvImageRenderer.Create id: " + id);
       this.surface = surface;
       this.id = id;
       this.scalingType = scalingType;
@@ -179,7 +180,7 @@
     }
 
     private void createTextures() {
-      Log.d(TAG, "  YuvImageRenderer.createTextures " + id + " on GL thread:" +
+      Logging.d(TAG, "  YuvImageRenderer.createTextures " + id + " on GL thread:" +
           Thread.currentThread().getId());
 
       // Generate 3 texture ids for Y/U/V and place them into |yuvTextures|.
@@ -200,7 +201,7 @@
             (screenHeight * layoutInPercentage.top + 99) / 100,
             (screenWidth * layoutInPercentage.right) / 100,
             (screenHeight * layoutInPercentage.bottom) / 100);
-        Log.d(TAG, "ID: "  + id + ". AdjustTextureCoords. Allowed display size: "
+        Logging.d(TAG, "ID: "  + id + ". AdjustTextureCoords. Allowed display size: "
             + displayLayout.width() + " x " + displayLayout.height() + ". Video: " + videoWidth
             + " x " + videoHeight + ". Rotation: " + rotationDegree + ". Mirror: " + mirror);
         final float videoAspectRatio = (rotationDegree % 180 == 0)
@@ -211,12 +212,12 @@
             videoAspectRatio, displayLayout.width(), displayLayout.height());
         displayLayout.inset((displayLayout.width() - displaySize.x) / 2,
                             (displayLayout.height() - displaySize.y) / 2);
-        Log.d(TAG, "  Adjusted display size: " + displayLayout.width() + " x "
+        Logging.d(TAG, "  Adjusted display size: " + displayLayout.width() + " x "
             + displayLayout.height());
         layoutMatrix = RendererCommon.getLayoutMatrix(
             mirror, videoAspectRatio, (float) displayLayout.width() / displayLayout.height());
         updateLayoutProperties = false;
-        Log.d(TAG, "  AdjustTextureCoords done");
+        Logging.d(TAG, "  AdjustTextureCoords done");
       }
     }
 
@@ -283,13 +284,13 @@
 
     private void logStatistics() {
       long timeSinceFirstFrameNs = System.nanoTime() - startTimeNs;
-      Log.d(TAG, "ID: " + id + ". Type: " + rendererType +
+      Logging.d(TAG, "ID: " + id + ". Type: " + rendererType +
           ". Frames received: " + framesReceived +
           ". Dropped: " + framesDropped + ". Rendered: " + framesRendered);
       if (framesReceived > 0 && framesRendered > 0) {
-        Log.d(TAG, "Duration: " + (int)(timeSinceFirstFrameNs / 1e6) +
+        Logging.d(TAG, "Duration: " + (int)(timeSinceFirstFrameNs / 1e6) +
             " ms. FPS: " + (float)framesRendered * 1e9 / timeSinceFirstFrameNs);
-        Log.d(TAG, "Draw time: " +
+        Logging.d(TAG, "Draw time: " +
             (int) (drawTimeNs / (1000 * framesRendered)) + " us. Copy time: " +
             (int) (copyTimeNs / (1000 * framesReceived)) + " us");
       }
@@ -300,7 +301,7 @@
         if (screenWidth == this.screenWidth && screenHeight == this.screenHeight) {
           return;
         }
-        Log.d(TAG, "ID: " + id + ". YuvImageRenderer.setScreenSize: " +
+        Logging.d(TAG, "ID: " + id + ". YuvImageRenderer.setScreenSize: " +
             screenWidth + " x " + screenHeight);
         this.screenWidth = screenWidth;
         this.screenHeight = screenHeight;
@@ -317,7 +318,7 @@
             && mirror == this.mirror) {
           return;
         }
-        Log.d(TAG, "ID: " + id + ". YuvImageRenderer.setPosition: (" + x + ", " + y +
+        Logging.d(TAG, "ID: " + id + ". YuvImageRenderer.setPosition: (" + x + ", " + y +
             ") " +  width + " x " + height + ". Scaling: " + scalingType +
             ". Mirror: " + mirror);
         this.layoutInPercentage.set(layoutInPercentage);
@@ -333,20 +334,20 @@
         return;
       }
       if (rendererEvents != null) {
-        Log.d(TAG, "ID: " + id +
+        Logging.d(TAG, "ID: " + id +
             ". Reporting frame resolution changed to " + videoWidth + " x " + videoHeight);
         rendererEvents.onFrameResolutionChanged(videoWidth, videoHeight, rotation);
       }
 
       synchronized (updateLayoutLock) {
-        Log.d(TAG, "ID: " + id + ". YuvImageRenderer.setSize: " +
+        Logging.d(TAG, "ID: " + id + ". YuvImageRenderer.setSize: " +
             videoWidth + " x " + videoHeight + " rotation " + rotation);
 
         this.videoWidth = videoWidth;
         this.videoHeight = videoHeight;
         rotationDegree = rotation;
         updateLayoutProperties = true;
-        Log.d(TAG, "  YuvImageRenderer.setSize done.");
+        Logging.d(TAG, "  YuvImageRenderer.setSize done.");
       }
     }
 
@@ -358,7 +359,7 @@
         return;
       }
       if (!seenFrame && rendererEvents != null) {
-        Log.d(TAG, "ID: " + id + ". Reporting first rendered frame.");
+        Logging.d(TAG, "ID: " + id + ". Reporting first rendered frame.");
         rendererEvents.onFirstFrameRendered();
       }
       framesReceived++;
@@ -368,7 +369,7 @@
           if (frame.yuvStrides[0] < frame.width ||
               frame.yuvStrides[1] < frame.width / 2 ||
               frame.yuvStrides[2] < frame.width / 2) {
-            Log.e(TAG, "Incorrect strides " + frame.yuvStrides[0] + ", " +
+            Logging.e(TAG, "Incorrect strides " + frame.yuvStrides[0] + ", " +
                 frame.yuvStrides[1] + ", " + frame.yuvStrides[2]);
             VideoRenderer.renderFrameDone(frame);
             return;
@@ -394,7 +395,7 @@
   /** Passes GLSurfaceView to video renderer. */
   public static synchronized void setView(GLSurfaceView surface,
       Runnable eglContextReadyCallback) {
-    Log.d(TAG, "VideoRendererGui.setView");
+    Logging.d(TAG, "VideoRendererGui.setView");
     instance = new VideoRendererGui(surface);
     eglContextReady = eglContextReadyCallback;
   }
@@ -408,7 +409,7 @@
     if (instance == null){
       return;
     }
-    Log.d(TAG, "VideoRendererGui.dispose");
+    Logging.d(TAG, "VideoRendererGui.dispose");
     synchronized (instance.yuvImageRenderers) {
       for (YuvImageRenderer yuvImageRenderer : instance.yuvImageRenderers) {
         yuvImageRenderer.release();
@@ -489,7 +490,7 @@
   public static synchronized void update(
       VideoRenderer.Callbacks renderer, int x, int y, int width, int height,
       RendererCommon.ScalingType scalingType, boolean mirror) {
-    Log.d(TAG, "VideoRendererGui.update");
+    Logging.d(TAG, "VideoRendererGui.update");
     if (instance == null) {
       throw new RuntimeException(
           "Attempt to update yuv renderer before setting GLSurfaceView");
@@ -505,7 +506,7 @@
 
   public static synchronized void setRendererEvents(
       VideoRenderer.Callbacks renderer, RendererCommon.RendererEvents rendererEvents) {
-    Log.d(TAG, "VideoRendererGui.setRendererEvents");
+    Logging.d(TAG, "VideoRendererGui.setRendererEvents");
     if (instance == null) {
       throw new RuntimeException(
           "Attempt to set renderer events before setting GLSurfaceView");
@@ -520,7 +521,7 @@
   }
 
   public static synchronized void remove(VideoRenderer.Callbacks renderer) {
-    Log.d(TAG, "VideoRendererGui.remove");
+    Logging.d(TAG, "VideoRendererGui.remove");
     if (instance == null) {
       throw new RuntimeException(
           "Attempt to remove yuv renderer before setting GLSurfaceView");
@@ -528,7 +529,7 @@
     synchronized (instance.yuvImageRenderers) {
       final int index = instance.yuvImageRenderers.indexOf(renderer);
       if (index == -1) {
-        Log.w(TAG, "Couldn't remove renderer (not present in current list)");
+        Logging.w(TAG, "Couldn't remove renderer (not present in current list)");
       } else {
         instance.yuvImageRenderers.remove(index).release();
       }
@@ -538,12 +539,12 @@
   @SuppressLint("NewApi")
   @Override
   public void onSurfaceCreated(GL10 unused, EGLConfig config) {
-    Log.d(TAG, "VideoRendererGui.onSurfaceCreated");
+    Logging.d(TAG, "VideoRendererGui.onSurfaceCreated");
     // Store render EGL context.
     if (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION) {
       synchronized (VideoRendererGui.class) {
         eglContext = EGL14.eglGetCurrentContext();
-        Log.d(TAG, "VideoRendererGui EGL Context: " + eglContext);
+        Logging.d(TAG, "VideoRendererGui EGL Context: " + eglContext);
       }
     }
 
@@ -570,7 +571,7 @@
 
   @Override
   public void onSurfaceChanged(GL10 unused, int width, int height) {
-    Log.d(TAG, "VideoRendererGui.onSurfaceChanged: " +
+    Logging.d(TAG, "VideoRendererGui.onSurfaceChanged: " +
         width + " x " + height + "  ");
     screenWidth = width;
     screenHeight = height;
diff --git a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java
index 3c85bd3..4809cf6 100644
--- a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java
+++ b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java
@@ -37,9 +37,10 @@
 import android.opengl.GLES11Ext;
 import android.opengl.GLES20;
 import android.os.Build;
-import android.util.Log;
 import android.view.Surface;
 
+import org.webrtc.Logging;
+
 import java.nio.ByteBuffer;
 
 // Java-side of peerconnection_jni.cc:MediaCodecVideoDecoder.
@@ -128,7 +129,7 @@
       if (name == null) {
         continue;  // No HW support in this codec; try the next one.
       }
-      Log.v(TAG, "Found candidate decoder " + name);
+      Logging.v(TAG, "Found candidate decoder " + name);
 
       // Check if this is supported decoder.
       boolean supportedCodec = false;
@@ -146,13 +147,13 @@
       CodecCapabilities capabilities =
           info.getCapabilitiesForType(mime);
       for (int colorFormat : capabilities.colorFormats) {
-        Log.v(TAG, "   Color: 0x" + Integer.toHexString(colorFormat));
+        Logging.v(TAG, "   Color: 0x" + Integer.toHexString(colorFormat));
       }
       for (int supportedColorFormat : supportedColorList) {
         for (int codecColorFormat : capabilities.colorFormats) {
           if (codecColorFormat == supportedColorFormat) {
             // Found supported HW decoder.
-            Log.d(TAG, "Found target decoder " + name +
+            Logging.d(TAG, "Found target decoder " + name +
                 ". Color: 0x" + Integer.toHexString(codecColorFormat));
             return new DecoderProperties(name, codecColorFormat);
           }
@@ -199,11 +200,11 @@
     if (properties == null) {
       throw new RuntimeException("Cannot find HW decoder for " + type);
     }
-    Log.d(TAG, "Java initDecode: " + type + " : "+ width + " x " + height +
+    Logging.d(TAG, "Java initDecode: " + type + " : "+ width + " x " + height +
         ". Color: 0x" + Integer.toHexString(properties.colorFormat) +
         ". Use Surface: " + useSurface);
     if (sharedContext != null) {
-      Log.d(TAG, "Decoder shared EGL Context: " + sharedContext);
+      Logging.d(TAG, "Decoder shared EGL Context: " + sharedContext);
     }
     mediaCodecThread = Thread.currentThread();
     try {
@@ -221,7 +222,7 @@
 
         // Create output surface
         textureID = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
-        Log.d(TAG, "Video decoder TextureID = " + textureID);
+        Logging.d(TAG, "Video decoder TextureID = " + textureID);
         surfaceTexture = new SurfaceTexture(textureID);
         surface = new Surface(surfaceTexture);
         decodeSurface = surface;
@@ -231,7 +232,7 @@
       if (!useSurface) {
         format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat);
       }
-      Log.d(TAG, "  Format: " + format);
+      Logging.d(TAG, "  Format: " + format);
       mediaCodec =
           MediaCodecVideoEncoder.createByCodecName(properties.codecName);
       if (mediaCodec == null) {
@@ -242,30 +243,30 @@
       colorFormat = properties.colorFormat;
       outputBuffers = mediaCodec.getOutputBuffers();
       inputBuffers = mediaCodec.getInputBuffers();
-      Log.d(TAG, "Input buffers: " + inputBuffers.length +
+      Logging.d(TAG, "Input buffers: " + inputBuffers.length +
           ". Output buffers: " + outputBuffers.length);
       return true;
     } catch (IllegalStateException e) {
-      Log.e(TAG, "initDecode failed", e);
+      Logging.e(TAG, "initDecode failed", e);
       return false;
     }
   }
 
   private void release() {
-    Log.d(TAG, "Java releaseDecoder");
+    Logging.d(TAG, "Java releaseDecoder");
     checkOnMediaCodecThread();
     try {
       mediaCodec.stop();
       mediaCodec.release();
     } catch (IllegalStateException e) {
-      Log.e(TAG, "release failed", e);
+      Logging.e(TAG, "release failed", e);
     }
     mediaCodec = null;
     mediaCodecThread = null;
     if (useSurface) {
       surface.release();
       if (textureID != 0) {
-        Log.d(TAG, "Delete video decoder TextureID " + textureID);
+        Logging.d(TAG, "Delete video decoder TextureID " + textureID);
         GLES20.glDeleteTextures(1, new int[] {textureID}, 0);
         textureID = 0;
       }
@@ -281,7 +282,7 @@
     try {
       return mediaCodec.dequeueInputBuffer(DEQUEUE_INPUT_TIMEOUT);
     } catch (IllegalStateException e) {
-      Log.e(TAG, "dequeueIntputBuffer failed", e);
+      Logging.e(TAG, "dequeueIntputBuffer failed", e);
       return -2;
     }
   }
@@ -296,7 +297,7 @@
       return true;
     }
     catch (IllegalStateException e) {
-      Log.e(TAG, "decode failed", e);
+      Logging.e(TAG, "decode failed", e);
       return false;
     }
   }
@@ -328,15 +329,15 @@
           result == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
         if (result == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
           outputBuffers = mediaCodec.getOutputBuffers();
-          Log.d(TAG, "Decoder output buffers changed: " + outputBuffers.length);
+          Logging.d(TAG, "Decoder output buffers changed: " + outputBuffers.length);
         } else if (result == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
           MediaFormat format = mediaCodec.getOutputFormat();
-          Log.d(TAG, "Decoder format changed: " + format.toString());
+          Logging.d(TAG, "Decoder format changed: " + format.toString());
           width = format.getInteger(MediaFormat.KEY_WIDTH);
           height = format.getInteger(MediaFormat.KEY_HEIGHT);
           if (!useSurface && format.containsKey(MediaFormat.KEY_COLOR_FORMAT)) {
             colorFormat = format.getInteger(MediaFormat.KEY_COLOR_FORMAT);
-            Log.d(TAG, "Color: 0x" + Integer.toHexString(colorFormat));
+            Logging.d(TAG, "Color: 0x" + Integer.toHexString(colorFormat));
             // Check if new color space is supported.
             boolean validColorFormat = false;
             for (int supportedColorFormat : supportedColorList) {
@@ -346,7 +347,7 @@
               }
             }
             if (!validColorFormat) {
-              Log.e(TAG, "Non supported color format");
+              Logging.e(TAG, "Non supported color format");
               return new DecoderOutputBufferInfo(-1, 0, 0, -1);
             }
           }
@@ -356,7 +357,7 @@
           if (format.containsKey("slice-height")) {
             sliceHeight = format.getInteger("slice-height");
           }
-          Log.d(TAG, "Frame stride and slice height: "
+          Logging.d(TAG, "Frame stride and slice height: "
               + stride + " x " + sliceHeight);
           stride = Math.max(width, stride);
           sliceHeight = Math.max(height, sliceHeight);
@@ -369,7 +370,7 @@
       }
       return null;
     } catch (IllegalStateException e) {
-      Log.e(TAG, "dequeueOutputBuffer failed", e);
+      Logging.e(TAG, "dequeueOutputBuffer failed", e);
       return new DecoderOutputBufferInfo(-1, 0, 0, -1);
     }
   }
@@ -382,7 +383,7 @@
       mediaCodec.releaseOutputBuffer(index, useSurface);
       return true;
     } catch (IllegalStateException e) {
-      Log.e(TAG, "releaseOutputBuffer failed", e);
+      Logging.e(TAG, "releaseOutputBuffer failed", e);
       return false;
     }
   }
diff --git a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
index d85dd3a..dfff8f2 100644
--- a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
+++ b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
@@ -35,7 +35,8 @@
 import android.media.MediaFormat;
 import android.os.Build;
 import android.os.Bundle;
-import android.util.Log;
+
+import org.webrtc.Logging;
 
 import java.nio.ByteBuffer;
 import java.util.Arrays;
@@ -125,7 +126,7 @@
     if (mime.equals(H264_MIME_TYPE)) {
       List<String> exceptionModels = Arrays.asList(H264_HW_EXCEPTION_MODELS);
       if (exceptionModels.contains(Build.MODEL)) {
-        Log.w(TAG, "Model: " + Build.MODEL +
+        Logging.w(TAG, "Model: " + Build.MODEL +
             " has black listed H.264 encoder.");
         return null;
       }
@@ -146,7 +147,7 @@
       if (name == null) {
         continue;  // No HW support in this codec; try the next one.
       }
-      Log.v(TAG, "Found candidate encoder " + name);
+      Logging.v(TAG, "Found candidate encoder " + name);
 
       // Check if this is supported HW encoder.
       boolean supportedCodec = false;
@@ -162,7 +163,7 @@
 
       CodecCapabilities capabilities = info.getCapabilitiesForType(mime);
       for (int colorFormat : capabilities.colorFormats) {
-        Log.v(TAG, "   Color: 0x" + Integer.toHexString(colorFormat));
+        Logging.v(TAG, "   Color: 0x" + Integer.toHexString(colorFormat));
       }
 
       // Check if codec supports either yuv420 or nv12.
@@ -170,7 +171,7 @@
         for (int codecColorFormat : capabilities.colorFormats) {
           if (codecColorFormat == supportedColorFormat) {
             // Found supported HW encoder.
-            Log.d(TAG, "Found target encoder for mime " + mime + " : " + name +
+            Logging.d(TAG, "Found target encoder for mime " + mime + " : " + name +
                 ". Color: 0x" + Integer.toHexString(codecColorFormat));
             return new EncoderProperties(name, codecColorFormat);
           }
@@ -209,7 +210,7 @@
   // Return the array of input buffers, or null on failure.
   private ByteBuffer[] initEncode(
       VideoCodecType type, int width, int height, int kbps, int fps) {
-    Log.d(TAG, "Java initEncode: " + type + " : " + width + " x " + height +
+    Logging.d(TAG, "Java initEncode: " + type + " : " + width + " x " + height +
         ". @ " + kbps + " kbps. Fps: " + fps +
         ". Color: 0x" + Integer.toHexString(colorFormat));
     if (mediaCodecThread != null) {
@@ -239,7 +240,7 @@
       format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat);
       format.setInteger(MediaFormat.KEY_FRAME_RATE, fps);
       format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, keyFrameIntervalSec);
-      Log.d(TAG, "  Format: " + format);
+      Logging.d(TAG, "  Format: " + format);
       mediaCodec = createByCodecName(properties.codecName);
       if (mediaCodec == null) {
         return null;
@@ -250,11 +251,11 @@
       colorFormat = properties.colorFormat;
       outputBuffers = mediaCodec.getOutputBuffers();
       ByteBuffer[] inputBuffers = mediaCodec.getInputBuffers();
-      Log.d(TAG, "Input buffers: " + inputBuffers.length +
+      Logging.d(TAG, "Input buffers: " + inputBuffers.length +
           ". Output buffers: " + outputBuffers.length);
       return inputBuffers;
     } catch (IllegalStateException e) {
-      Log.e(TAG, "initEncode failed", e);
+      Logging.e(TAG, "initEncode failed", e);
       return null;
     }
   }
@@ -269,7 +270,7 @@
         // indicate this in queueInputBuffer() below and guarantee _this_ frame
         // be encoded as a key frame, but sadly that flag is ignored.  Instead,
         // we request a key frame "soon".
-        Log.d(TAG, "Sync frame request");
+        Logging.d(TAG, "Sync frame request");
         Bundle b = new Bundle();
         b.putInt(MediaCodec.PARAMETER_KEY_REQUEST_SYNC_FRAME, 0);
         mediaCodec.setParameters(b);
@@ -279,19 +280,19 @@
       return true;
     }
     catch (IllegalStateException e) {
-      Log.e(TAG, "encode failed", e);
+      Logging.e(TAG, "encode failed", e);
       return false;
     }
   }
 
   private void release() {
-    Log.d(TAG, "Java releaseEncoder");
+    Logging.d(TAG, "Java releaseEncoder");
     checkOnMediaCodecThread();
     try {
       mediaCodec.stop();
       mediaCodec.release();
     } catch (IllegalStateException e) {
-      Log.e(TAG, "release failed", e);
+      Logging.e(TAG, "release failed", e);
     }
     mediaCodec = null;
     mediaCodecThread = null;
@@ -301,14 +302,14 @@
     // frameRate argument is ignored - HW encoder is supposed to use
     // video frame timestamps for bit allocation.
     checkOnMediaCodecThread();
-    Log.v(TAG, "setRates: " + kbps + " kbps. Fps: " + frameRateIgnored);
+    Logging.v(TAG, "setRates: " + kbps + " kbps. Fps: " + frameRateIgnored);
     try {
       Bundle params = new Bundle();
       params.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE, 1000 * kbps);
       mediaCodec.setParameters(params);
       return true;
     } catch (IllegalStateException e) {
-      Log.e(TAG, "setRates failed", e);
+      Logging.e(TAG, "setRates failed", e);
       return false;
     }
   }
@@ -320,7 +321,7 @@
     try {
       return mediaCodec.dequeueInputBuffer(DEQUEUE_TIMEOUT);
     } catch (IllegalStateException e) {
-      Log.e(TAG, "dequeueIntputBuffer failed", e);
+      Logging.e(TAG, "dequeueIntputBuffer failed", e);
       return -2;
     }
   }
@@ -354,7 +355,7 @@
         boolean isConfigFrame =
             (info.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0;
         if (isConfigFrame) {
-          Log.d(TAG, "Config frame generated. Offset: " + info.offset +
+          Logging.d(TAG, "Config frame generated. Offset: " + info.offset +
               ". Size: " + info.size);
           configData = ByteBuffer.allocateDirect(info.size);
           outputBuffers[result].position(info.offset);
@@ -377,10 +378,10 @@
         boolean isKeyFrame =
             (info.flags & MediaCodec.BUFFER_FLAG_SYNC_FRAME) != 0;
         if (isKeyFrame) {
-          Log.d(TAG, "Sync frame generated");
+          Logging.d(TAG, "Sync frame generated");
         }
         if (isKeyFrame && type == VideoCodecType.VIDEO_CODEC_H264) {
-          Log.d(TAG, "Appending config frame of size " + configData.capacity() +
+          Logging.d(TAG, "Appending config frame of size " + configData.capacity() +
               " to output buffer with offset " + info.offset + ", size " +
               info.size);
           // For H.264 key frame append SPS and PPS NALs at the start
@@ -406,7 +407,7 @@
       }
       throw new RuntimeException("dequeueOutputBuffer: " + result);
     } catch (IllegalStateException e) {
-      Log.e(TAG, "dequeueOutputBuffer failed", e);
+      Logging.e(TAG, "dequeueOutputBuffer failed", e);
       return new OutputBufferInfo(-1, null, false, -1);
     }
   }
@@ -419,7 +420,7 @@
       mediaCodec.releaseOutputBuffer(index, false);
       return true;
     } catch (IllegalStateException e) {
-      Log.e(TAG, "releaseOutputBuffer failed", e);
+      Logging.e(TAG, "releaseOutputBuffer failed", e);
       return false;
     }
   }