Index: talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java |
diff --git a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java |
index 6518dc6d00e805234a231a9278339181384ee648..777f6f9e6add5b2cb9f67aa66fd593e4902f5c05 100644 |
--- a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java |
+++ b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java |
@@ -33,15 +33,13 @@ import android.media.MediaCodecInfo; |
import android.media.MediaCodecInfo.CodecCapabilities; |
import android.media.MediaCodecList; |
import android.media.MediaFormat; |
-import android.opengl.EGL14; |
import android.opengl.EGLContext; |
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. |
@@ -130,7 +128,7 @@ public class MediaCodecVideoDecoder { |
if (name == null) { |
continue; // No HW support in this codec; try the next one. |
} |
- Logging.v(TAG, "Found candidate decoder " + name); |
+ Log.v(TAG, "Found candidate decoder " + name); |
// Check if this is supported decoder. |
boolean supportedCodec = false; |
@@ -148,13 +146,13 @@ public class MediaCodecVideoDecoder { |
CodecCapabilities capabilities = |
info.getCapabilitiesForType(mime); |
for (int colorFormat : capabilities.colorFormats) { |
- Logging.v(TAG, " Color: 0x" + Integer.toHexString(colorFormat)); |
+ Log.v(TAG, " Color: 0x" + Integer.toHexString(colorFormat)); |
} |
for (int supportedColorFormat : supportedColorList) { |
for (int codecColorFormat : capabilities.colorFormats) { |
if (codecColorFormat == supportedColorFormat) { |
// Found supported HW decoder. |
- Logging.d(TAG, "Found target decoder " + name + |
+ Log.d(TAG, "Found target decoder " + name + |
". Color: 0x" + Integer.toHexString(codecColorFormat)); |
return new DecoderProperties(name, codecColorFormat); |
} |
@@ -204,11 +202,11 @@ public class MediaCodecVideoDecoder { |
if (properties == null) { |
throw new RuntimeException("Cannot find HW decoder for " + type); |
} |
- Logging.d(TAG, "Java initDecode: " + type + " : "+ width + " x " + height + |
+ Log.d(TAG, "Java initDecode: " + type + " : "+ width + " x " + height + |
". Color: 0x" + Integer.toHexString(properties.colorFormat) + |
". Use Surface: " + useSurface); |
if (sharedContext != null) { |
- Logging.d(TAG, "Decoder shared EGL Context: " + sharedContext); |
+ Log.d(TAG, "Decoder shared EGL Context: " + sharedContext); |
} |
mediaCodecThread = Thread.currentThread(); |
try { |
@@ -227,7 +225,7 @@ public class MediaCodecVideoDecoder { |
// Create output surface |
textureID = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES); |
- Logging.d(TAG, "Video decoder TextureID = " + textureID); |
+ Log.d(TAG, "Video decoder TextureID = " + textureID); |
surfaceTexture = new SurfaceTexture(textureID); |
surface = new Surface(surfaceTexture); |
decodeSurface = surface; |
@@ -237,7 +235,7 @@ public class MediaCodecVideoDecoder { |
if (!useSurface) { |
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat); |
} |
- Logging.d(TAG, " Format: " + format); |
+ Log.d(TAG, " Format: " + format); |
mediaCodec = |
MediaCodecVideoEncoder.createByCodecName(properties.codecName); |
if (mediaCodec == null) { |
@@ -248,30 +246,30 @@ public class MediaCodecVideoDecoder { |
colorFormat = properties.colorFormat; |
outputBuffers = mediaCodec.getOutputBuffers(); |
inputBuffers = mediaCodec.getInputBuffers(); |
- Logging.d(TAG, "Input buffers: " + inputBuffers.length + |
+ Log.d(TAG, "Input buffers: " + inputBuffers.length + |
". Output buffers: " + outputBuffers.length); |
return true; |
} catch (IllegalStateException e) { |
- Logging.e(TAG, "initDecode failed", e); |
+ Log.e(TAG, "initDecode failed", e); |
return false; |
} |
} |
private void release() { |
- Logging.d(TAG, "Java releaseDecoder"); |
+ Log.d(TAG, "Java releaseDecoder"); |
checkOnMediaCodecThread(); |
try { |
mediaCodec.stop(); |
mediaCodec.release(); |
} catch (IllegalStateException e) { |
- Logging.e(TAG, "release failed", e); |
+ Log.e(TAG, "release failed", e); |
} |
mediaCodec = null; |
mediaCodecThread = null; |
if (useSurface) { |
surface.release(); |
if (textureID != 0) { |
- Logging.d(TAG, "Delete video decoder TextureID " + textureID); |
+ Log.d(TAG, "Delete video decoder TextureID " + textureID); |
GLES20.glDeleteTextures(1, new int[] {textureID}, 0); |
textureID = 0; |
} |
@@ -287,7 +285,7 @@ public class MediaCodecVideoDecoder { |
try { |
return mediaCodec.dequeueInputBuffer(DEQUEUE_INPUT_TIMEOUT); |
} catch (IllegalStateException e) { |
- Logging.e(TAG, "dequeueIntputBuffer failed", e); |
+ Log.e(TAG, "dequeueIntputBuffer failed", e); |
return -2; |
} |
} |
@@ -302,7 +300,7 @@ public class MediaCodecVideoDecoder { |
return true; |
} |
catch (IllegalStateException e) { |
- Logging.e(TAG, "decode failed", e); |
+ Log.e(TAG, "decode failed", e); |
return false; |
} |
} |
@@ -334,15 +332,15 @@ public class MediaCodecVideoDecoder { |
result == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { |
if (result == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) { |
outputBuffers = mediaCodec.getOutputBuffers(); |
- Logging.d(TAG, "Decoder output buffers changed: " + outputBuffers.length); |
+ Log.d(TAG, "Decoder output buffers changed: " + outputBuffers.length); |
} else if (result == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { |
MediaFormat format = mediaCodec.getOutputFormat(); |
- Logging.d(TAG, "Decoder format changed: " + format.toString()); |
+ Log.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); |
- Logging.d(TAG, "Color: 0x" + Integer.toHexString(colorFormat)); |
+ Log.d(TAG, "Color: 0x" + Integer.toHexString(colorFormat)); |
// Check if new color space is supported. |
boolean validColorFormat = false; |
for (int supportedColorFormat : supportedColorList) { |
@@ -352,7 +350,7 @@ public class MediaCodecVideoDecoder { |
} |
} |
if (!validColorFormat) { |
- Logging.e(TAG, "Non supported color format"); |
+ Log.e(TAG, "Non supported color format"); |
return new DecoderOutputBufferInfo(-1, 0, 0, -1); |
} |
} |
@@ -362,7 +360,7 @@ public class MediaCodecVideoDecoder { |
if (format.containsKey("slice-height")) { |
sliceHeight = format.getInteger("slice-height"); |
} |
- Logging.d(TAG, "Frame stride and slice height: " |
+ Log.d(TAG, "Frame stride and slice height: " |
+ stride + " x " + sliceHeight); |
stride = Math.max(width, stride); |
sliceHeight = Math.max(height, sliceHeight); |
@@ -375,7 +373,7 @@ public class MediaCodecVideoDecoder { |
} |
return null; |
} catch (IllegalStateException e) { |
- Logging.e(TAG, "dequeueOutputBuffer failed", e); |
+ Log.e(TAG, "dequeueOutputBuffer failed", e); |
return new DecoderOutputBufferInfo(-1, 0, 0, -1); |
} |
} |
@@ -391,7 +389,7 @@ public class MediaCodecVideoDecoder { |
mediaCodec.releaseOutputBuffer(index, render); |
return true; |
} catch (IllegalStateException e) { |
- Logging.e(TAG, "releaseOutputBuffer failed", e); |
+ Log.e(TAG, "releaseOutputBuffer failed", e); |
return false; |
} |
} |