From bfdcc9f800154c7ea40ee896a22ad3f8e40fe5d0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 7 Jul 2012 19:50:59 +0200 Subject: [PATCH] fix capmt refcounting if switching to unlocked channel CRemoteControl::startvideo() and stopvideo() did trigger a resend of the capmt, which lead to refcounting issues. Fix this by adding parameters to lock/unlockPlayback to disable the sending of capmt and set this in start/stopvideo. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e52cc57efbcc31b2936bcb05da923cbc1aec121f Author: Stefan Seyfried Date: 2012-07-07 (Sat, 07 Jul 2012) ------------------ This commit was generated by Migit --- src/daemonc/remotecontrol.cpp | 8 ++++--- src/zapit/include/zapit/client/zapitclient.h | 8 +++---- src/zapit/lib/zapitclient.cpp | 25 +++++++++++++------- src/zapit/src/zapit.cpp | 25 +++++++++++++++++--- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 9f1df8890..4836f7435 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -4,6 +4,8 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ + (C) 2008-2012 Stefan Seyfried + Kommentar: Diese GUI wurde von Grund auf neu programmiert und sollte nun vom @@ -688,7 +690,7 @@ void CRemoteControl::startvideo() { is_video_started= true; //g_Zapit->startPlayBack(); - g_Zapit->unlockPlayBack(); + g_Zapit->unlockPlayBack(false); } } @@ -700,9 +702,9 @@ void CRemoteControl::stopvideo() #if HAVE_TRIPLEDRAGON /* we need stopPlayback to blank video, lockPlayback prevents it from being inadvertently starting */ - g_Zapit->stopPlayBack(); + g_Zapit->stopPlayBack(false); #endif - g_Zapit->lockPlayBack(); + g_Zapit->lockPlayBack(false); } } diff --git a/src/zapit/include/zapit/client/zapitclient.h b/src/zapit/include/zapit/client/zapitclient.h index 1c160ca21..717424dbc 100644 --- a/src/zapit/include/zapit/client/zapitclient.h +++ b/src/zapit/include/zapit/client/zapitclient.h @@ -481,10 +481,10 @@ class CZapitClient:public CBasicClient /****************************************/ void setStandby(const bool enable); - void startPlayBack(); - void stopPlayBack(); - void lockPlayBack(); - void unlockPlayBack(); + void startPlayBack(const bool sendpmt = false); + void stopPlayBack(const bool sendpmt = false); + void lockPlayBack(const bool sendpmt = true); + void unlockPlayBack(const bool sendpmt = true); bool tune_TP(TP_params TP); bool isPlayBackActive(); void setDisplayFormat(const video_display_format_t mode); diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index 2af969c2f..2ba2a79cb 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -4,6 +4,7 @@ * Zapit client interface - DBoxII-Project * * (C) 2002 by thegoodguy & the DBoxII-Project + * (C) 2007-2012 Stefan Seyfried * * License: GPL * @@ -935,30 +936,38 @@ void CZapitClient::setVideoSystem(int video_system) } -void CZapitClient::startPlayBack() +void CZapitClient::startPlayBack(const bool sendpmt) { - send(CZapitMessages::CMD_SB_START_PLAYBACK); + CZapitMessages::commandBoolean msg; + msg.truefalse = sendpmt; + send(CZapitMessages::CMD_SB_START_PLAYBACK, (char*)&msg, sizeof(msg)); close_connection(); } -void CZapitClient::stopPlayBack() +void CZapitClient::stopPlayBack(const bool sendpmt) { - send(CZapitMessages::CMD_SB_STOP_PLAYBACK); + CZapitMessages::commandBoolean msg; + msg.truefalse = sendpmt; + send(CZapitMessages::CMD_SB_STOP_PLAYBACK, (char*)&msg, sizeof(msg)); CZapitMessages::responseCmd response; CBasicClient::receive_data((char* )&response, sizeof(response)); close_connection(); } -void CZapitClient::lockPlayBack() +void CZapitClient::lockPlayBack(const bool sendpmt) { - send(CZapitMessages::CMD_SB_LOCK_PLAYBACK); + CZapitMessages::commandBoolean msg; + msg.truefalse = sendpmt; + send(CZapitMessages::CMD_SB_LOCK_PLAYBACK, (char*)&msg, sizeof(msg)); CZapitMessages::responseCmd response; CBasicClient::receive_data((char* )&response, sizeof(response)); close_connection(); } -void CZapitClient::unlockPlayBack() +void CZapitClient::unlockPlayBack(const bool sendpmt) { - send(CZapitMessages::CMD_SB_UNLOCK_PLAYBACK); + CZapitMessages::commandBoolean msg; + msg.truefalse = sendpmt; + send(CZapitMessages::CMD_SB_UNLOCK_PLAYBACK, (char*)&msg, sizeof(msg)); CZapitMessages::responseCmd response; CBasicClient::receive_data((char* )&response, sizeof(response)); close_connection(); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 8513068be..86d836a4b 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -1333,32 +1333,51 @@ printf("[zapit] TP_id %d freq %d rate %d fec %d pol %d\n", TP.TP_id, TP.feparams } case CZapitMessages::CMD_SB_START_PLAYBACK: + { + CZapitMessages::commandBoolean msgBool; + CBasicServer::receive_data(connfd, &msgBool, sizeof(msgBool)); //playbackStopForced = false; StartPlayBack(current_channel); + if (msgBool.truefalse) + SendPMT(); break; + } case CZapitMessages::CMD_SB_STOP_PLAYBACK: - StopPlayBack(false); + { + CZapitMessages::commandBoolean msgBool; + CBasicServer::receive_data(connfd, &msgBool, sizeof(msgBool)); + StopPlayBack(msgBool.truefalse); response.cmd = CZapitMessages::CMD_READY; CBasicServer::send_data(connfd, &response, sizeof(response)); break; + } case CZapitMessages::CMD_SB_LOCK_PLAYBACK: + { + CZapitMessages::commandBoolean msgBool; + CBasicServer::receive_data(connfd, &msgBool, sizeof(msgBool)); /* hack. if standby true, dont blank video */ standby = true; - StopPlayBack(true); + StopPlayBack(msgBool.truefalse); standby = false; playbackStopForced = true; response.cmd = CZapitMessages::CMD_READY; CBasicServer::send_data(connfd, &response, sizeof(response)); break; + } case CZapitMessages::CMD_SB_UNLOCK_PLAYBACK: + { + CZapitMessages::commandBoolean msgBool; + CBasicServer::receive_data(connfd, &msgBool, sizeof(msgBool)); playbackStopForced = false; StartPlayBack(current_channel); - SendPMT(); + if (msgBool.truefalse) + SendPMT(); response.cmd = CZapitMessages::CMD_READY; CBasicServer::send_data(connfd, &response, sizeof(response)); break; + } case CZapitMessages::CMD_SET_DISPLAY_FORMAT: { CZapitMessages::commandInt msg; CBasicServer::receive_data(connfd, &msg, sizeof(msg));