Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
7fe5dbdc
Commit
7fe5dbdc
authored
Jul 18, 2009
by
Hugo Beauzee-Luyssen
Browse files
Using WaitCondition to synchronize startRender
parent
57b52f88
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Workflow/ClipWorkflow.cpp
View file @
7fe5dbdc
...
...
@@ -39,6 +39,7 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_stateLock
=
new
QReadWriteLock
;
m_requiredStateLock
=
new
QMutex
;
m_waitCond
=
new
WaitCondition
;
m_initWaitCond
=
new
WaitCondition
;
// m_backBufferLock = new QReadWriteLock;
}
...
...
@@ -46,6 +47,7 @@ ClipWorkflow::~ClipWorkflow()
{
// delete[] m_backBuffer;
// delete m_backBufferLock;
delete
m_initWaitCond
;
delete
m_waitCond
;
delete
m_requiredStateLock
;
delete
m_stateLock
;
...
...
@@ -209,8 +211,9 @@ ClipWorkflow::State ClipWorkflow::getState() const
void
ClipWorkflow
::
startRender
()
{
while
(
isReady
()
==
false
)
SleepMS
(
1
);
if
(
isReady
()
==
false
)
m_initWaitCond
->
wait
();
m_mediaPlayer
->
play
();
setState
(
Rendering
);
}
...
...
@@ -253,10 +256,25 @@ bool ClipWorkflow::isRendering() const
return
m_state
==
ClipWorkflow
::
Rendering
;
}
void
ClipWorkflow
::
checkSynchronisation
(
State
newState
)
{
switch
(
newState
)
{
case
Ready
:
m_initWaitCond
->
wake
();
break
;
default:
break
;
}
}
void
ClipWorkflow
::
setState
(
State
state
)
{
QWriteLocker
lock
(
m_stateLock
);
m_state
=
state
;
{
QWriteLocker
lock
(
m_stateLock
);
m_state
=
state
;
}
checkSynchronisation
(
state
);
}
void
ClipWorkflow
::
queryStateChange
(
State
newState
)
...
...
src/Workflow/ClipWorkflow.h
View file @
7fe5dbdc
...
...
@@ -154,6 +154,7 @@ class ClipWorkflow : public QObject
static
void
unlock
(
ClipWorkflow
*
clipWorkflow
);
void
setVmem
();
void
setState
(
State
state
);
void
checkSynchronisation
(
State
newState
);
/**
* Don't ever call this method from anywhere else than the unlock() method
*/
...
...
@@ -192,6 +193,8 @@ class ClipWorkflow : public QObject
QAtomicInt
m_oneFrameOnly
;
WaitCondition
*
m_initWaitCond
;
private
slots
:
void
pauseAfterPlaybackStarted
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment