Merge "StreamOut: Fix STREAM_EVENT_CBK_TYPE_CODEC_FORMAT_CHANGED" am: 66ffc5b99a
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1692490 Change-Id: I8da5b65e922c3fae06d29f4e4a990d66dacfe5d0
This commit is contained in:
commit
1e1514be04
2 changed files with 7 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue