A/libc:致命信号 11 (SIGSEGV) 位于 0x00000005(代码=1),线程 26834 Android 应用程序崩溃

A/libc: Fatal signal 11 (SIGSEGV) at 0x00000005 (code=1), thread 26834 Android app crash

我检查了这个问题的 and 个链接,但找不到任何解决方案。

我正在 android 中实现一个 RTSP 播放器,我为此使用了 Easy Player。使用这个播放器我已经实现了我的演示应用程序并输入了 rtsp:// URL.

问题: 当我在库示例代码中输入相同的 URL 时,它工作正常,但是当我尝试使用我的演示应用程序时,应用程序崩溃并出现以下堆栈跟踪。

04-20 16:13:57.189 26834-26834/com.easydrawindemo A/libc: Fatal signal 11 (SIGSEGV) at 0x00000005 (code=1), thread 26834 (.easydrawindemo)
    04-20 16:13:57.219 1163-1163/? D/BubblePopupHelper: isShowingBubblePopup : false
    04-20 16:13:57.289 292-292/? I/DEBUG: [04-20 16:13:57.295]
    04-20 16:13:57.289 292-292/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    04-20 16:13:57.289 292-292/? I/DEBUG: Build fingerprint: 'lge/g3_global_com/g3:4.4.2/KVT49L.D85510i/D85510i.1403169216:user/release-keys'
    04-20 16:13:57.289 292-292/? I/DEBUG: Revision: '10'
    04-20 16:13:57.289 292-292/? I/DEBUG: pid: 26834, tid: 26834, name: .easydrawindemo  >>> com.easydrawindemo <<<
    04-20 16:13:57.289 292-292/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000005
    04-20 16:13:57.289 971-1151/? D/WifiStateMachine: handleMessage: E msg.what=131155
    04-20 16:13:57.289 971-1151/? D/WifiStateMachine: processMsg: ConnectedState
    04-20 16:13:57.289 971-1151/? D/WifiStateMachine: processMsg: L2ConnectedState
    04-20 16:13:57.289 971-1151/? D/WifiNative-wlan0: doString: SIGNAL_POLL
    04-20 16:13:57.289 971-1182/? W/NativeCrashListener: Couldn't find ProcessRecord for pid 1529885741

这是我的片段class:

public class PlayerFragment extends Fragment implements TextureView.SurfaceTextureListener, PhotoViewAttacher.OnMatrixChangedListener {

    private TextureView videoSurfaceView;
    private ProgressBar pBarVideo;
    private String videoUrl;
    private int transType;
    protected EasyRTSPClient mStreamRender;
    protected ResultReceiver mResultReceiver;
    private MediaScannerConnection mScanner;
    private int mWidth, mHeight;
    private PhotoViewAttacher mAttacher;
    private static final String TAG = "PlayerFragment";
    public static final int RESULT_REND_STARTED = 1;
    public static final int RESULT_REND_VIDEO_DISPLAYED = 2;
    public static final int RESULT_REND_STOPED = -1;
    private ResultReceiver mRR;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setLandscapeOrientation();

        Log.i(TAG, "onCreate called");

        if (getArguments() != null) {
            Log.i(TAG, "onCreate if called");
            videoUrl = getArguments().getString(Constants.KEY_VIDEO_URL);
            transType = getArguments().getInt(Constants.KEY_PROTOCOL_TYPE);
            mRR = getArguments().getParcelable(Constants.KEY_RESULT_RECEIVER);
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_player, container, false);
        Log.i(TAG, "onCreateView called");
        videoSurfaceView = (TextureView) view.findViewById(R.id.videoSurfaceView);
        videoSurfaceView.setOpaque(false);
        videoSurfaceView.setSurfaceTextureListener(this);
        pBarVideo = (ProgressBar) view.findViewById(R.id.pBarVideo);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        Log.i(TAG, "onViewCreated called");

        mResultReceiver = new ResultReceiver(new Handler()) {
            @Override
            protected void onReceiveResult(int resultCode, Bundle resultData) {
                super.onReceiveResult(resultCode, resultData);
                PlayerActivity activity = (PlayerActivity) getActivity();
                if (activity == null)return;
                if (resultCode == EasyRTSPClient.RESULT_VIDEO_DISPLAYED) {
                    Log.i(TAG, "ResultReceiver RESULT_VIDEO_DISPLAYED called");
//                    onVideoDisplayed();
                }
                else if (resultCode == EasyRTSPClient.RESULT_VIDEO_SIZE) {
                    Log.i(TAG, "ResultReceiver RESULT_VIDEO_SIZE called");
                    mWidth = resultData.getInt(EasyRTSPClient.EXTRA_VIDEO_WIDTH);
                    mHeight = resultData.getInt(EasyRTSPClient.EXTRA_VIDEO_HEIGHT);
//                    onVideoSizeChange();
                }
                else if (resultCode == EasyRTSPClient.RESULT_TIMEOUT) {
                    Log.i(TAG, "ResultReceiver RESULT_TIMEOUT called");
                    new AlertDialog.Builder(getActivity()).setMessage("Timeout").setTitle("SORRY").setPositiveButton(android.R.string.ok, null).show();
                }
                else if (resultCode == EasyRTSPClient.RESULT_UNSUPPORTED_AUDIO) {
                    Log.i(TAG, "ResultReceiver RESULT_UNSUPPORTED_AUDIO called");
                    new AlertDialog.Builder(getActivity()).setMessage("Unsupported Audio").setTitle("SORRY").setPositiveButton(android.R.string.ok, null).show();
                }
                else if (resultCode == EasyRTSPClient.RESULT_UNSUPPORTED_VIDEO) {
                    Log.i(TAG, "ResultReceiver RESULT_UNSUPPORTED_VIDEO called");
                    new AlertDialog.Builder(getActivity()).setMessage("Unsupported Video").setTitle("SORRY").setPositiveButton(android.R.string.ok, null).show();
                }
                else if (resultCode == EasyRTSPClient.RESULT_EVENT){
                    Log.i(TAG, "ResultReceiver RESULT_EVENT called");
                    int errorcode = resultData.getInt("errorcode");
                    if (errorcode != 0){
                        stopRendering();
                    }
//                    activity.onEvent(PlayFragment.this, errorcode,resultData.getString("event-msg"));
                }
//                else if (resultCode == EasyRTSPClient.RESULT_RECORD_BEGIN){
//                    activity.onRecordState(1);
//                }
//                else if (resultCode == EasyRTSPClient.RESULT_RECORD_END){
//                    activity.onRecordState(-1);
//                }
            }
        };

        if (mAttacher != null) {
            mAttacher.cleanup();
        }

        mAttacher = new PhotoViewAttacher(videoSurfaceView, mWidth, mHeight);
        mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);
        mAttacher.setOnMatrixChangeListener(PlayerFragment.this);
        mAttacher.update();
    }

    public static PlayerFragment getInstance(String URL, int type, ResultReceiver rr) {
        Log.i(TAG, "getInstance called");
        PlayerFragment playerFragment = new PlayerFragment();
        Bundle bundle = new Bundle();
        bundle.putString(Constants.KEY_VIDEO_URL, URL);
        bundle.putInt(Constants.KEY_PROTOCOL_TYPE, type);
        bundle.putParcelable(Constants.KEY_RESULT_RECEIVER, rr);
        playerFragment.setArguments(bundle);
        return playerFragment;
    }

    private void setLandscapeOrientation() {
        Log.i(TAG, "setLandscapeOrientation called");
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }

    @Override
    public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
        Log.i(TAG, "onSurfaceTextureAvailable called");
        startRendering(surfaceTexture);
    }

    @Override
    public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {
        Log.i(TAG, "onSurfaceTextureSizeChanged called");
    }

    @Override
    public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
        Log.i(TAG, "onSurfaceTextureDestroyed called");
        stopRendering();
        return true;
    }

    @Override
    public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        Log.i(TAG, "onSurfaceTextureUpdated called");

    }

    private void startRendering(SurfaceTexture surface) {

        Log.i(TAG, "startRendering called");

        mStreamRender = new EasyRTSPClient(getActivity(), "79393674363536526D343241654D7859707A4F484A655A76636D63755A57467A65575268636E64706269356C59584E356347786865575679567778576F502B6C34456468646D6C754A6B4A68596D397A595541794D4445325257467A65555268636E6470626C526C5957316C59584E35", surface, mResultReceiver);
//        boolean autoRecord = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("auto_record", false);

//        File f = new File(TheApp.sMoviePath);
//        f.mkdirs();

        try {
            mStreamRender.start(videoUrl, transType, RTSPClient.EASY_SDK_VIDEO_FRAME_FLAG | RTSPClient.EASY_SDK_AUDIO_FRAME_FLAG, "", "", null);
        } catch (Exception e) {
            e.printStackTrace();
            Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
        }
//        mStreamRender.start2(mUrl, mType);
        mRR.send(RESULT_REND_STARTED, null);
    }

    private void stopRendering() {
        Log.i(TAG, "stopRendering called");
        if (mStreamRender != null) {
            mRR.send(RESULT_REND_STOPED, null);
            mStreamRender.stop();
            mStreamRender = null;
        }
    }

    @Override
    public void onMatrixChanged(RectF rectF) {
        Log.i(TAG, "onMatrixChanged called");
    }
}

我几乎尝试了所有方法,但找不到解决方案。如果我做错了什么,请指正并提供解决方案。

提前致谢。

我发现我的错误,在 Easy player 中,为每个包名称生成一个唯一的密钥,而在我的情况下,该密钥不正确。我不知道为什么它会为无效密钥提供内存泄漏错误!!替换包名称和密钥解决了这个问题。奇怪但真实。