Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
7fe5dbdc
Commit
7fe5dbdc
authored
Jul 18, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using WaitCondition to synchronize startRender
parent
57b52f88
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+22
-4
src/Workflow/ClipWorkflow.h
src/Workflow/ClipWorkflow.h
+3
-0
No files found.
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
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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