51 int shmHandle = shm_open(AAMP_SHARED_MEMORY_NAME.c_str(), AAMP_SHARED_MEMORY_CREATE_OFLAGS, AAMP_SHARED_MEMORY_MODE);
55 AAMPLOG_WARN(
"Failed to create Shared memory object: %d", errno);
62 int status = ftruncate(shmHandle, dataInSz);
65 AAMPLOG_WARN(
"Failed to truncate the Shared memory object %d", status);
69 void *dataWr = mmap(NULL, dataInSz, PROT_WRITE | PROT_READ, MAP_SHARED, shmHandle, 0);
72 AAMPLOG_WARN(
"Failed to map the Shared memory object %d", errno);
76 memmove(dataWr, dataIn, dataInSz);
78 status = munmap(dataWr, dataInSz);
81 AAMPLOG_WARN(
"Failed to unmap the Shared memory object %d", errno);
86 #ifdef AAMP_SHMEM_USE_SIZE_AND_INSTANCE
93 dataOut.resize(
sizeof(ib));
94 memcpy(dataOut.data(), &ib,
sizeof(ib));
104 int shmHandle = shm_open(AAMP_SHARED_MEMORY_NAME.c_str(), AAMP_SHARED_MEMORY_READ_OFLAGS, AAMP_SHARED_MEMORY_MODE);
108 AAMPLOG_WARN(
"Failed to create Shared memory object: %d", errno);
121 uint32_t packetSize = pib->
dataSize;
122 void *dataRd = mmap(NULL, packetSize, PROT_READ, MAP_SHARED, shmHandle, 0);
125 AAMPLOG_WARN(
"Failed to map the Shared memory object %d", errno);
129 if (packetSize > dataOutSz)
131 AAMPLOG_WARN(
"Received data is bigger than provided buffer. %d > %d", packetSize, dataOutSz);
133 memmove(dataOut, dataRd, std::min(packetSize, dataOutSz));
135 int status = munmap(dataRd, packetSize);
138 AAMPLOG_WARN(
"Failed to unmap the Shared memory object %d", errno);