LOGD("ext: %s, mem_size: %d, mmap(param): %p\n", ext, mem_size, param);
if (mem_size && param) {
- data->mem = param;
- data->mem_size = mem_size;
+ if (data->mem)
+ free(data->mem);
+
+ data->mem = malloc(mem_size);
+
+ if (data->mem) {
+ memcpy(data->mem, param, mem_size);
+ data->mem_size = mem_size;
+ } else {
+ LOGE("failed to alloc mem %d", mem_size);
+ }
+
data->uri_type = MM_PLAYER_URI_TYPE_MEM;
ret = MM_ERROR_NONE;
}
}
}
- /* FIXIT : we can use thouse in player->profile directly */
+ /* profile.mem or mem_buf.buf have to be free when player is destroyed */
if (player->profile.uri_type == MM_PLAYER_URI_TYPE_MEM) {
player->mem_buf.buf = (char *)player->profile.mem;
player->mem_buf.len = player->profile.mem_size;
__mmplayer_video_stream_destroy_bo_list(player);
__mmplayer_initialize_storage_info(player, MMPLAYER_PATH_MAX);
+ if (player->profile.mem) {
+ free(player->profile.mem);
+ player->profile.mem = NULL;
+ player->mem_buf.buf = NULL;
+ }
player->uri_info.uri_idx = 0;
MMPLAYER_FLEAVE();
}