当前位置: 首页>>代码示例>>Java>>正文


Java CodecException类代码示例

本文整理汇总了Java中android.media.MediaCodec.CodecException的典型用法代码示例。如果您正苦于以下问题:Java CodecException类的具体用法?Java CodecException怎么用?Java CodecException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CodecException类属于android.media.MediaCodec包,在下文中一共展示了CodecException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDiagnosticInfoV21

import android.media.MediaCodec.CodecException; //导入依赖的package包/类
@TargetApi(21)
private static String getDiagnosticInfoV21(Throwable cause) {
  if (cause instanceof CodecException) {
    return ((CodecException) cause).getDiagnosticInfo();
  }
  return null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:MediaCodecTrackRenderer.java

示例2: handleDecoderException

import android.media.MediaCodec.CodecException; //导入依赖的package包/类
private void handleDecoderException(Exception e, ByteBuffer buf, int codecFlags, boolean throwOnTransient) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (e instanceof CodecException) {
            CodecException codecExc = (CodecException) e;

            if (codecExc.isTransient() && !throwOnTransient) {
                // We'll let transient exceptions go
                LimeLog.warning(codecExc.getDiagnosticInfo());
                return;
            }

            LimeLog.severe(codecExc.getDiagnosticInfo());
        }
    }

    // Only throw if we're not stopping
    if (!stopping) {
        //
        // There seems to be a race condition with decoder/surface teardown causing some
        // decoders to to throw IllegalStateExceptions even before 'stopping' is set.
        // To workaround this while allowing real exceptions to propagate, we will eat the
        // first exception. If we are still receiving exceptions 3 seconds later, we will
        // throw the original exception again.
        //
        if (initialException != null) {
            // This isn't the first time we've had an exception processing video
            if (System.currentTimeMillis() - initialExceptionTimestamp >= EXCEPTION_REPORT_DELAY_MS) {
                // It's been over 3 seconds and we're still getting exceptions. Throw the original now.
                if (!reportedCrash) {
                    reportedCrash = true;
                    crashListener.notifyCrash(initialException);
                }
                throw initialException;
            }
        }
        else {
            // This is the first exception we've hit
            if (buf != null || codecFlags != 0) {
                initialException = new RendererException(this, e, buf, codecFlags);
            }
            else {
                initialException = new RendererException(this, e);
            }
            initialExceptionTimestamp = System.currentTimeMillis();
        }
    }
}
 
开发者ID:moonlight-stream,项目名称:moonlight-android,代码行数:48,代码来源:MediaCodecDecoderRenderer.java


注:本文中的android.media.MediaCodec.CodecException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。