#include <glib.h>
#include "legacy_player.h"
+#define DEBUG_FD_NUM 10
+#define MPLAYER_CLOSE_FD(fd) \
+do { \
+ if (fd > INVALID_DEFAULT_VALUE) { \
+ if (fd < DEBUG_FD_NUM) \
+ LOGW("close fd %d", fd); \
+ close(fd); \
+ } \
+} while (0)
+
typedef struct {
legacy_player_h player_handle;
tbm_bufmgr bufmgr;
if ((export_data) &&
(export_data->key == key || remove_all)) {
/* LOGD("buffer key : %d matched, remove it (remove_all %d)", key, remove_all); */
- if (export_data->tfd > INVALID_DEFAULT_VALUE) {
- close(export_data->tfd);
+ MPLAYER_CLOSE_FD(export_data->tfd);
export_data->tfd = INVALID_DEFAULT_VALUE;
- }
if (export_data->bo) {
tbm_bo_unref(export_data->bo);
export_data->bo = NULL;
ret_val = true;
ERROR:
- for (i = 0; i < bo_num; i++) {
- if (tfd[i] > INVALID_DEFAULT_VALUE)
- close(tfd[i]);
- }
+ for (i = 0; i < bo_num; i++)
+ MPLAYER_CLOSE_FD(tfd[i]);
return ret_val;
}
/* don't call bo unmap/unref here *
* it will be released at player_disp_deinit_memory_buffer() during _destroy */
-
- close(tfd);
+ MPLAYER_CLOSE_FD(tfd);
return ret;
ERROR:
- if (tfd > INVALID_DEFAULT_VALUE)
- close(tfd);
+ MPLAYER_CLOSE_FD(tfd);
if (bo)
tbm_bo_unref(bo);
else if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_RAW && buf)
muse_server_ipc_delete_data(buf);
push_media_stream_exit1:
- if (tfd > INVALID_DEFAULT_VALUE)
- close(tfd);
+ MPLAYER_CLOSE_FD(tfd);
if (jobj)
muse_core_msg_object_free(jobj);