From c6045b6e842ea309d2e0afded7f4f748c953934c Mon Sep 17 00:00:00 2001 From: zhangkai Date: Thu, 25 Jul 2024 20:33:54 +0800 Subject: [PATCH] =?UTF-8?q?ohaudio=20=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangkai --- .../Media/Audio/OHAudio/entry/src/main/cpp/audio.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/DocsSample/Media/Audio/OHAudio/entry/src/main/cpp/audio.cpp b/code/DocsSample/Media/Audio/OHAudio/entry/src/main/cpp/audio.cpp index d6bb88be4..0273d5a62 100644 --- a/code/DocsSample/Media/Audio/OHAudio/entry/src/main/cpp/audio.cpp +++ b/code/DocsSample/Media/Audio/OHAudio/entry/src/main/cpp/audio.cpp @@ -166,6 +166,9 @@ static napi_value AudioCapturerLowLatencyInit(napi_env env, napi_callback_info i OH_AudioStreamBuilder_SetLatencyMode(builder, AUDIOSTREAM_LATENCY_MODE_FAST); OH_AudioCapturer_Callbacks callbacks; callbacks.OH_AudioCapturer_OnReadData = AudioCapturerOnReadData; + callbacks.OH_AudioCapturer_OnError = nullptr; + callbacks.OH_AudioCapturer_OnInterruptEvent = nullptr; + callbacks.OH_AudioCapturer_OnStreamEvent = nullptr; OH_AudioStreamBuilder_SetCapturerCallback(builder, callbacks, nullptr); // 3. create OH_AudioCapturer OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); @@ -194,6 +197,9 @@ static napi_value AudioCapturerInit(napi_env env, napi_callback_info info) OH_AudioStreamBuilder_SetLatencyMode(builder, AUDIOSTREAM_LATENCY_MODE_NORMAL); OH_AudioCapturer_Callbacks callbacks; callbacks.OH_AudioCapturer_OnReadData = AudioCapturerOnReadData; + callbacks.OH_AudioCapturer_OnStreamEvent = nullptr; + callbacks.OH_AudioCapturer_OnInterruptEvent = nullptr; + callbacks.OH_AudioCapturer_OnError = nullptr; OH_AudioStreamBuilder_SetCapturerCallback(builder, callbacks, nullptr); // 3. create OH_AudioCapturer OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); @@ -268,6 +274,9 @@ static napi_value AudioRendererLowLatencyInit(napi_env env, napi_callback_info i OH_AudioStreamBuilder_SetLatencyMode(rendererBuilder, AUDIOSTREAM_LATENCY_MODE_FAST); OH_AudioRenderer_Callbacks rendererCallbacks; rendererCallbacks.OH_AudioRenderer_OnWriteData = AudioRendererOnWriteData; + rendererCallbacks.OH_AudioRenderer_OnError = nullptr; + rendererCallbacks.OH_AudioRenderer_OnInterruptEvent = nullptr; + rendererCallbacks.OH_AudioRenderer_OnStreamEvent = nullptr; OH_AudioStreamBuilder_SetRendererCallback(rendererBuilder, rendererCallbacks, nullptr); // create OH_AudioRenderer OH_AudioStreamBuilder_GenerateRenderer(rendererBuilder, &audioRenderer); @@ -301,6 +310,9 @@ static napi_value AudioRendererInit(napi_env env, napi_callback_info info) OH_AudioStreamBuilder_SetLatencyMode(rendererBuilder, AUDIOSTREAM_LATENCY_MODE_NORMAL); OH_AudioRenderer_Callbacks rendererCallbacks; rendererCallbacks.OH_AudioRenderer_OnWriteData = AudioRendererOnWriteData; + rendererCallbacks.OH_AudioRenderer_OnStreamEvent = nullptr; + rendererCallbacks.OH_AudioRenderer_OnInterruptEvent = nullptr; + rendererCallbacks.OH_AudioRenderer_OnError = nullptr; OH_AudioStreamBuilder_SetRendererCallback(rendererBuilder, rendererCallbacks, nullptr); // create OH_AudioRenderer OH_AudioStreamBuilder_GenerateRenderer(rendererBuilder, &audioRenderer);