ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#define LOG_TAG "RadioMetadataWrapper"
//#define LOG_NDEBUG 0
 
#include <system/RadioMetadataWrapper.h>
#include <log/log.h>
 
namespace android {
 
RadioMetadataWrapper::RadioMetadataWrapper(radio_metadata_t **metadata)
    : mMetadata(metadata)
{
    *mMetadata = nullptr;
 
    auto status = radio_metadata_allocate(mMetadata, 0, 0);
    if (status != 0) {
        // *mMetadata remains NULL if allocation fails
        ALOGE("Failed to allocate metadata buffer");
    }
}
 
RadioMetadataWrapper::~RadioMetadataWrapper()
{
    radio_metadata_deallocate(*mMetadata);
}
 
}  // namespace android