Bug fix in the suspend/resume feature.

parent 1ab3e4b6
......@@ -2,7 +2,7 @@
* ps2ts.cpp: threaded PS to TS converter
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: ps2ts.cpp,v 1.3 2002/03/17 23:20:22 bozo Exp $
* $Id: ps2ts.cpp,v 1.4 2002/04/02 16:15:11 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -159,6 +159,9 @@ void C_Ps2TsMpegConverter::InitWork()
//------------------------------------------------------------------------------
void C_Ps2TsMpegConverter::DoWork()
{
// Initialize the condition in the new thread.
m_cResumeCond.Protect();
C_String strPgrmName = m_pBroadcast->GetProgram()->GetName();
LogDbg(m_hLog, "Starting to read program \"" + strPgrmName + "\"");
......@@ -243,6 +246,8 @@ void C_Ps2TsMpegConverter::DoWork()
m_pEventHandler->HandleEvent(cEvent);
}
m_cResumeCond.Release();
LogDbg(m_hLog, "Converter stopped for program " + strPgrmName);
}
......
......@@ -2,7 +2,7 @@
* ts2ts.cpp: threaded TS to TS converter
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: ts2ts.cpp,v 1.3 2002/03/17 23:20:22 bozo Exp $
* $Id: ts2ts.cpp,v 1.4 2002/04/02 16:15:11 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -126,6 +126,9 @@ void C_Ts2TsMpegConverter::InitWork()
//------------------------------------------------------------------------------
void C_Ts2TsMpegConverter::DoWork()
{
// Initialize the condition in the new thread.
m_cResumeCond.Protect();
C_String strPgrmName = m_pBroadcast->GetProgram()->GetName();
LogDbg(m_hLog, "Starting to read program \"" + strPgrmName + "\"");
......@@ -201,6 +204,8 @@ void C_Ts2TsMpegConverter::DoWork()
m_pEventHandler->HandleEvent(cEvent);
}
m_cResumeCond.Release();
LogDbg(m_hLog, "Converter stopped for program " + strPgrmName);
}
......
......@@ -2,7 +2,7 @@
* converter.cpp: Threaded Mpeg converters
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: converter.cpp,v 1.2 2002/03/17 23:20:22 bozo Exp $
* $Id: converter.cpp,v 1.3 2002/04/02 16:15:11 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -95,8 +95,6 @@ void C_MpegConverter::InitWork()
{
m_iShortPauseStatus = m_iLongPauseStatus = STATUS_RUNNING;
m_cResumeCond.Protect();
m_bStop = false;
m_pReader->Init();
......@@ -128,9 +126,9 @@ void C_MpegConverter::CleanWork()
//------------------------------------------------------------------------------
void C_MpegConverter::Resume()
{
m_cResumeCond.Signal();
m_cResumeCond.Protect();
m_cResumeCond.Release();
m_cResumeCond.Signal();
}
......@@ -140,8 +138,6 @@ void C_MpegConverter::Resume()
void C_MpegConverter::Suspend()
{
m_iLongPauseStatus = STATUS_PAUSE_REQUEST;
m_cResumeCond.Protect();
}
......@@ -151,8 +147,6 @@ void C_MpegConverter::Suspend()
void C_MpegConverter::ShortPause()
{
m_iShortPauseStatus = STATUS_PAUSE_REQUEST;
m_cResumeCond.Protect();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment