gpt4 book ai didi

android - RecordingProxy::releaseRecordingFrame 在 Android 手机上录制时每 25 毫秒在日志中重复一次

转载 作者:行者123 更新时间:2023-11-30 02:55:31 28 4
gpt4 key购买 nike

当我在自制的应用程序中录制视频时,我得到这两行每 25 毫秒左右重复一次(然后它会立即填充日志文件):

04-28 09:33:07.705: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:33:07.705: V/Camera(3161): releaseRecordingFrame

我认为这不正常,因为我也经常遇到臭名昭著的“媒体服务器死机”错误或电影崩溃。这是在 4.0.4 Samsung Discover 设备上。我在我的 LG optimus one 设备上看不到这些日志行。

您会在代码 here 中找到这些日志行每次“//当时间戳帧准备就绪时从相机服务回调”。正常吗?我读到在日志中输入太多内容最终会减慢应用程序的运行速度/使应用程序出错。更多代码如下。谢谢!

这是登录视频开始:

04-28 09:33:05.635: V/Camera-JNI(3161): unlock
04-28 09:33:05.635: V/Camera-JNI(3161): get_native_camera: context=0x1287378, camera=0x1473a88
04-28 09:33:05.635: V/Camera-JNI(3161): get_native_camera: context=0x1287378, camera=0x1473a88
04-28 09:33:05.635: V/Camera(3161): getProxy
04-28 09:33:05.645: V/MediaProfilesJNI(3161): native_get_camcorder_profile: 0 1
04-28 09:33:05.665: D/ASC(3161): mounted
04-28 09:33:05.685: V/VoirCam(3161): ts 1398691985695
04-28 09:33:05.925: V/Camera(3161): RecordingProxy::startRecording
04-28 09:33:05.925: V/Camera(3161): reconnect
04-28 09:33:05.925: V/Camera(3161): startRecording
04-28 09:33:06.305: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:33:06.305: V/Camera(3161): releaseRecordingFrame
04-28 09:33:06.325: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:33:06.325: V/Camera(3161): releaseRecordingFrame
04-28 09:33:06.325: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:33:06.325: V/Camera(3161): releaseRecordingFrame
04-28 09:33:06.345: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:33:06.345: V/Camera(3161): releaseRecordingFrame
04-28 09:33:06.375: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:33:06.375: V/Camera(3161): releaseRecordingFrame

并停止:

04-28 09:29:38.555: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:29:38.555: V/Camera(3161): releaseRecordingFrame
04-28 09:29:38.695: V/Camera(3161): RecordingProxy::releaseRecordingFrame
04-28 09:29:38.695: V/Camera(3161): releaseRecordingFrame
04-28 09:29:38.705: V/Camera(3161): RecordingProxy::stopRecording
04-28 09:29:38.705: V/Camera(3161): stopRecording
04-28 09:29:39.065: V/Camera-JNI(3161): lock
04-28 09:29:39.065: V/Camera-JNI(3161): get_native_camera: context=0x1287378, camera=0x1473a88
04-28 09:29:39.065: V/Camera-JNI(3161): lock
04-28 09:29:39.065: V/Camera-JNI(3161): get_native_camera: context=0x1287378, camera=0x1473a88

录音是这样开始的:

    if (prepareVideoRecorder()) {
mMediaRecorder.start();
}

我的 prepareVideoRecorder 函数是:

private boolean prepareVideoRecorder(){

mMediaRecorder = new MediaRecorder();
// Step 1: Unlock and set camera to MediaRecorder
mCamera.unlock();
mMediaRecorder.setCamera(mCamera);
// Step 2: Set sources
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
CamcorderProfile camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);

camcorderProfile.videoCodec = MediaRecorder.VideoEncoder.H264;
camcorderProfile.audioCodec = MediaRecorder.AudioEncoder.AAC;
camcorderProfile.fileFormat = MediaRecorder.OutputFormat.MPEG_4;


// Step 3: Set a CamcorderProfile (requires API Level 8 or higher)

mMediaRecorder.setProfile(camcorderProfile);
// Step 4: Set output file

mMediaRecorder.setOutputFile(getOutputMediaFile(MEDIA_TYPE_VIDEO).toString());

mMediaRecorder.setPreviewDisplay(mPreview.getHolder().getSurface());


// Step 6: Prepare configured MediaRecorder
try {
mMediaRecorder.prepare();
} catch (IllegalStateException e) {
Log.d(TAG, "IllegalStateException preparing MediaRecorder: " + e.getMessage());
releaseMediaRecorder();
return false;
} catch (IOException e) {
Log.d(TAG, "IOException preparing MediaRecorder: " + e.getMessage());
releaseMediaRecorder();
return false;
}
return true;

最佳答案

该消息预计不会出现,但可能不是出于您预期的原因。

在 Android 源代码中,详细级别的日志记录 (ALOGV) 是默认编译出来的。要启用它,您需要在包含 Log.h header 之前将符号 LOG_NDEBUG 定义为零。查看出现在 androidcodesearch.com 链接中的源文件,您可以在第 18 行看到这个 #define -- 被注释掉。如果您正在调试 Camera 实现,您将从取消注释该行开始。

看起来无论是谁构建了您正在使用的系统(三星?)都为该文件启用了详细日志记录并将其保持打开状态,因此仅打算在调试期间显示的消息始终打开。

我之前没有看过这段代码,但我猜该函数通常每帧运行一次。所以您所看到的可能是“正常”的。

关于android - RecordingProxy::releaseRecordingFrame 在 Android 手机上录制时每 25 毫秒在日志中重复一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23343121/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com