Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
profile: improve prch_sq destroy
  • Loading branch information
perexg committed Mar 11, 2015
1 parent 9dbaa44 commit ffa0639
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/profile.c
Expand Up @@ -680,6 +680,7 @@ profile_chain_init(profile_chain_t *prch, profile_t *pro, void *id)
prch->prch_pro = pro;
prch->prch_id = id;
streaming_queue_init(&prch->prch_sq, 0, 0);
prch->prch_sq_used = 1;
LIST_INSERT_HEAD(&profile_chains, prch, prch_link);
prch->prch_linked = 1;
prch->prch_stop = 1;
Expand Down Expand Up @@ -738,6 +739,7 @@ profile_chain_raw_open(profile_chain_t *prch, void *id, size_t qsize)
prch->prch_id = id;
prch->prch_flags = SUBSCRIPTION_RAW_MPEGTS;
streaming_queue_init(&prch->prch_sq, SMT_PACKET, qsize);
prch->prch_sq_used = 1;
prch->prch_st = &prch->prch_sq.sq_st;
prch->prch_muxer = muxer_create(&c);
return 0;
Expand Down Expand Up @@ -772,8 +774,12 @@ profile_chain_close(profile_chain_t *prch)

prch->prch_st = NULL;

if (prch->prch_linked) {
if (prch->prch_sq_used) {
streaming_queue_deinit(&prch->prch_sq);
prch->prch_sq_used = 0;
}

if (prch->prch_linked) {
LIST_REMOVE(prch, prch_link);
prch->prch_linked = 0;
}
Expand All @@ -782,6 +788,8 @@ profile_chain_close(profile_chain_t *prch)
profile_release(prch->prch_pro);
prch->prch_pro = NULL;
}

prch->prch_id = NULL;
}

/*
Expand Down
1 change: 1 addition & 0 deletions src/profile.h
Expand Up @@ -74,6 +74,7 @@ typedef struct profile_chain {
int prch_flags;
int prch_stop;
int prch_start_pending;
int prch_sq_used;
struct streaming_queue prch_sq;
struct streaming_target *prch_post_share;
struct streaming_target *prch_st;
Expand Down

0 comments on commit ffa0639

Please sign in to comment.