Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f4f0582 authored by Gilad Broner's avatar Gilad Broner
Browse files

media: dvb: Fix recording with multiple PIDs



A recording pipe can have multiple feeds associated to it, one of which
is considered to be the pipe's parent feed. In case the parent feed is
closed and pipe handler is called an invalid parent feed will be used.
To avoid such case, the parent feed will be updated with another valid
feed in case the current parent feed is closed.

Change-Id: Iadcc7e346aad84958cd8c8bcc4e282779251c591
Signed-off-by: default avatarGilad Broner <gbroner@codeaurora.org>
parent f82aaf71
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -4531,6 +4531,25 @@ static int mpq_dmx_release_rec_pipe(struct dvb_demux_feed *feed)
		mpq_dmx_terminate_out_pipe(pipe_info);
		pipe_info->parent = NULL;
		pipe_info->pipe_handler = NULL;
	} else {
		/*
		 * Recording pipe may have multiple feeds associated with it.
		 * If the pipe's parent feed was released we must assign another
		 * valid feed for the pipe handler to work with.
		 */
		if (pipe_info->parent == tspp2_feed) {
			struct dvb_demux_feed *feed_tmp;
			struct mpq_feed *mpq_feed_tmp;

			feed_tmp = mpq_dmx_peer_rec_feed(feed);
			if (feed_tmp) {
				MPQ_DVB_DBG_PRINT(
					"%s: Switching pipe parent from feed(pid=%u) to feed(pid=%u)\n",
					__func__, feed->pid, feed_tmp->pid);
				mpq_feed_tmp = feed_tmp->priv;
				pipe_info->parent = mpq_feed_tmp->plugin_priv;
			}
		}
	}

	mutex_unlock(&pipe_info->mutex);