mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
StreamOut: Fix STREAM_EVENT_CBK_TYPE_CODEC_FORMAT_CHANGED
Use audio_metadata_byte_string_len method in asyncEventCallback. Test: atest metadata_tests Bug: 186894288 Change-Id: I04914bc5b2c778002b53b8f8da5bf29fff5c80f8
This commit is contained in:
@@ -56,6 +56,7 @@ cc_defaults {
|
||||
"android.hardware.audio-impl_headers",
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
"libaudioclient_headers",
|
||||
"libaudioutils_headers",
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
"libmedia_headers",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <HidlUtils.h>
|
||||
#include <android/log.h>
|
||||
#include <audio_utils/Metadata.h>
|
||||
#include <hardware/audio.h>
|
||||
#include <util/CoreUtils.h>
|
||||
#include <utils/Trace.h>
|
||||
@@ -742,7 +743,11 @@ int StreamOut::asyncEventCallback(stream_event_callback_type_t event, void* para
|
||||
switch (event) {
|
||||
case STREAM_EVENT_CBK_TYPE_CODEC_FORMAT_CHANGED: {
|
||||
hidl_vec<uint8_t> audioMetadata;
|
||||
audioMetadata.setToExternal((uint8_t*)param, strlen((char*)param));
|
||||
// void* param is the byte string buffer from byte_string_from_audio_metadata().
|
||||
// As the byte string buffer may have embedded zeroes, we cannot use strlen()
|
||||
// but instead use audio_utils::metadata::dataByteStringLen().
|
||||
audioMetadata.setToExternal((uint8_t*)param, audio_utils::metadata::dataByteStringLen(
|
||||
(const uint8_t*)param));
|
||||
result = eventCallback->onCodecFormatChanged(audioMetadata);
|
||||
} break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user