Index: talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java |
diff --git a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java |
index d85dd3a5dd9c5b89dd2a28b2d464c6b8207e868c..dfff8f26912fbc62d9dd08fee9997c9ce2867d43 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.MediaCodecList; |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
// 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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
// 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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
// 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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
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 @@ public class MediaCodecVideoEncoder { |
} |
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 @@ public class MediaCodecVideoEncoder { |
mediaCodec.releaseOutputBuffer(index, false); |
return true; |
} catch (IllegalStateException e) { |
- Log.e(TAG, "releaseOutputBuffer failed", e); |
+ Logging.e(TAG, "releaseOutputBuffer failed", e); |
return false; |
} |
} |