未验证 提交 d157a891 编写于 作者: O openharmony_ci 提交者: Gitee

!9516 屏幕录制NDK适配

Merge pull request !9516 from 戴伟琦/master
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <map> #include <map>
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <cinttypes>
#include "napi/native_api.h" #include "napi/native_api.h"
#include "native_avscreen_capture.h" #include "native_avscreen_capture.h"
#include "native_avscreen_capture_base.h" #include "native_avscreen_capture_base.h"
...@@ -107,7 +108,7 @@ void ScreenCaptureNdkTestCallback::OnAudioBufferAvailable(bool isReady, OH_Audio ...@@ -107,7 +108,7 @@ void ScreenCaptureNdkTestCallback::OnAudioBufferAvailable(bool isReady, OH_Audio
if (OH_AVScreenCapture_AcquireAudioBuffer(screenCapture_, &audioBuffer, type) == AV_SCREEN_CAPTURE_ERR_OK) { if (OH_AVScreenCapture_AcquireAudioBuffer(screenCapture_, &audioBuffer, type) == AV_SCREEN_CAPTURE_ERR_OK) {
LOG(audioBuffer != nullptr, "AcquireAudioBuffer failed, audio buffer empty"); LOG(audioBuffer != nullptr, "AcquireAudioBuffer failed, audio buffer empty");
LOG(g_aIndex % g_logCount != 0, LOG(g_aIndex % g_logCount != 0,
"AcquireAudioBuffer, audioBufferLen: %d, timestampe: %lld, audioSourceType: %d", "AcquireAudioBuffer, audioBufferLen: %d, timestampe: %" PRId64", audioSourceType: %d",
audioBuffer->size, audioBuffer->timestamp, audioBuffer->type); audioBuffer->size, audioBuffer->timestamp, audioBuffer->type);
if ((aFile != nullptr) && (audioBuffer->buf != nullptr) && (type == OH_MIC)) { if ((aFile != nullptr) && (audioBuffer->buf != nullptr) && (type == OH_MIC)) {
int32_t ret = fwrite(audioBuffer->buf, 1, audioBuffer->size, aFile); int32_t ret = fwrite(audioBuffer->buf, 1, audioBuffer->size, aFile);
...@@ -158,7 +159,7 @@ void ScreenCaptureNdkTestCallback::OnVideoBufferAvailable(bool isReady) ...@@ -158,7 +159,7 @@ void ScreenCaptureNdkTestCallback::OnVideoBufferAvailable(bool isReady)
OH_NativeBuffer_GetConfig(nativeBuffer, &config); OH_NativeBuffer_GetConfig(nativeBuffer, &config);
int32_t length = config.height * config.width * size; int32_t length = config.height * config.width * size;
LOG(g_vIndex % g_logCount != 0, LOG(g_vIndex % g_logCount != 0,
"AcquireVideoBuffer, videoBufferLen: %d, timestamp: %lld, size: %d", length, timestamp, length); "AcquireVideoBuffer, videoBufferLen: %d, timestamp: %" PRId64", size: %d", length, timestamp, length);
DumpVideoFile(nativeBuffer, length); DumpVideoFile(nativeBuffer, length);
OH_NativeBuffer_Unreference(nativeBuffer); OH_NativeBuffer_Unreference(nativeBuffer);
if (g_vFlag == 1) { if (g_vFlag == 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册