Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
memoryinfo: add mpegts input queue entry
  • Loading branch information
perexg committed May 13, 2016
1 parent ba0eb9b commit c195db2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/input/mpegts.c
Expand Up @@ -18,6 +18,9 @@

#include "input.h"
#include "mpegts/fastscan.h"
#include "memoryinfo.h"

extern memoryinfo_t mpegts_input_queue_memoryinfo;

void
mpegts_init ( int linuxdvb_mask, int nosatip, str_list_t *satip_client,
Expand All @@ -30,6 +33,9 @@ mpegts_init ( int linuxdvb_mask, int nosatip, str_list_t *satip_client,
idclass_register(&mpegts_service_class);
idclass_register(&mpegts_service_raw_class);

/* Memory info */
memoryinfo_register(&mpegts_input_queue_memoryinfo);

/* FastScan init */
dvb_fastscan_init();

Expand Down
4 changes: 4 additions & 0 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -26,12 +26,14 @@
#include "notify.h"
#include "idnode.h"
#include "dbus.h"
#include "memoryinfo.h"

#include <pthread.h>
#include <assert.h>
#include <fcntl.h>
#include <sys/stat.h>

memoryinfo_t mpegts_input_queue_memoryinfo = { .my_name = "MPEG-TS input queue" };

static void
mpegts_input_del_network ( mpegts_network_link_t *mnl );
Expand Down Expand Up @@ -1121,6 +1123,7 @@ mpegts_input_recv_packets

pthread_mutex_lock(&mi->mi_input_lock);
if (mmi->mmi_mux->mm_active == mmi) {
memoryinfo_alloc(&mpegts_input_queue_memoryinfo, sizeof(mpegts_packet_t) + len2);
TAILQ_INSERT_TAIL(&mi->mi_input_queue, mp, mp_link);
tvh_cond_signal(&mi->mi_input_cond, 0);
} else {
Expand Down Expand Up @@ -1470,6 +1473,7 @@ mpegts_input_thread ( void * p )
tvh_cond_wait(&mi->mi_input_cond, &mi->mi_input_lock);
continue;
}
memoryinfo_free(&mpegts_input_queue_memoryinfo, sizeof(mpegts_packet_t) + mp->mp_len);
TAILQ_REMOVE(&mi->mi_input_queue, mp, mp_link);
pthread_mutex_unlock(&mi->mi_input_lock);

Expand Down

0 comments on commit c195db2

Please sign in to comment.