Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
87e73d35
Commit
87e73d35
authored
Sep 23, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolved potential bug when rendering too fast
parent
9ef8e805
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
12 deletions
+40
-12
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+5
-5
src/Workflow/MainWorkflow.cpp
src/Workflow/MainWorkflow.cpp
+8
-4
src/Workflow/MainWorkflow.h
src/Workflow/MainWorkflow.h
+2
-1
src/Workflow/TrackWorkflow.cpp
src/Workflow/TrackWorkflow.cpp
+23
-1
src/Workflow/TrackWorkflow.h
src/Workflow/TrackWorkflow.h
+2
-1
No files found.
src/Workflow/ClipWorkflow.cpp
View file @
87e73d35
...
...
@@ -74,7 +74,7 @@ void ClipWorkflow::checkStateChange()
if
(
m_requiredState
!=
ClipWorkflow
::
None
)
{
m_state
=
m_requiredState
;
//
qDebug() << '[' << (void*)this << "] Applying required state change:" << m_state;
qDebug
()
<<
'['
<<
(
void
*
)
this
<<
"] Applying required state change:"
<<
m_state
;
m_requiredState
=
ClipWorkflow
::
None
;
checkSynchronisation
(
m_state
);
}
...
...
@@ -85,7 +85,7 @@ void ClipWorkflow::lock( ClipWorkflow* cw, void** pp_ret, int size )
Q_UNUSED
(
size
);
cw
->
m_renderLock
->
lock
();
*
pp_ret
=
cw
->
m_buffer
;
//
qDebug() << '[' << (void*)cw << "] ClipWorkflow::lock";
qDebug
()
<<
'['
<<
(
void
*
)
cw
<<
"] ClipWorkflow::lock"
;
}
void
ClipWorkflow
::
unlock
(
ClipWorkflow
*
cw
,
void
*
buffer
,
int
width
,
int
height
,
int
bpp
,
int
size
)
...
...
@@ -110,7 +110,7 @@ void ClipWorkflow::unlock( ClipWorkflow* cw, void* buffer, int width, int hei
cw
->
m_renderWaitCond
->
wake
();
}
cw
->
emit
renderComplete
(
cw
);
//
qDebug() << "Emmiting render completed";
qDebug
()
<<
"Emmiting render completed"
;
// qDebug() << "Entering cond wait";
cw
->
m_waitCond
->
wait
(
cw
->
m_condMutex
);
...
...
@@ -122,7 +122,7 @@ void ClipWorkflow::unlock( ClipWorkflow* cw, void* buffer, int width, int hei
}
else
cw
->
m_stateLock
->
unlock
();
//
qDebug() << '[' << (void*)cw << "] ClipWorkflow::unlock";
qDebug
()
<<
'['
<<
(
void
*
)
cw
<<
"] ClipWorkflow::unlock"
;
cw
->
checkStateChange
();
}
...
...
@@ -303,7 +303,7 @@ void ClipWorkflow::setState( State state )
{
{
QWriteLocker
lock
(
m_stateLock
);
//
qDebug() << '[' << (void*)this << "] Setting state to" << state;
qDebug
()
<<
'['
<<
(
void
*
)
this
<<
"] Setting state to"
<<
state
;
m_state
=
state
;
}
checkSynchronisation
(
state
);
...
...
src/Workflow/MainWorkflow.cpp
View file @
87e73d35
...
...
@@ -54,12 +54,14 @@ MainWorkflow::MainWorkflow( int trackCount ) :
m_highestTrackNumberMutex
=
new
QMutex
;
m_synchroneRenderWaitCondition
=
new
QWaitCondition
;
m_synchroneRenderWaitConditionMutex
=
new
QMutex
;
m_nbTracksToRenderMutex
=
new
QMutex
;
}
MainWorkflow
::~
MainWorkflow
()
{
stop
();
delete
m_nbTracksToRenderMutex
;
delete
m_synchroneRenderWaitConditionMutex
;
delete
m_synchroneRenderWaitCondition
;
delete
m_highestTrackNumberMutex
;
...
...
@@ -125,12 +127,13 @@ void MainWorkflow::getOutput()
m_synchroneRenderingBuffer
=
NULL
;
if
(
m_renderStarted
==
true
)
{
QMutexLocker
lockNbTracks
(
m_nbTracksToRenderMutex
);
for
(
unsigned
int
i
=
0
;
i
<
m_trackCount
;
++
i
)
{
if
(
m_tracks
[
i
].
activated
()
==
false
)
continue
;
m_nbTracksToRender
.
fetchAndAddAcquire
(
1
)
;
++
m_nbTracksToRender
;
m_tracks
[
i
]
->
getOutput
(
m_currentFrame
);
}
if
(
m_paused
==
false
)
...
...
@@ -272,8 +275,8 @@ void MainWorkflow::moveClip( const QUuid& clipUuid, unsigned int oldTr
}
else
{
Clip
*
clip
=
m_tracks
[
oldTrack
]
->
removeClip
(
clipUuid
);
m_tracks
[
newTrack
]
->
addClip
(
c
lip
,
startingFrame
);
Clip
Workflow
*
cw
=
m_tracks
[
oldTrack
]
->
removeClip
Workflow
(
clipUuid
);
m_tracks
[
newTrack
]
->
addClip
(
c
w
,
startingFrame
);
activateTrack
(
oldTrack
);
activateTrack
(
newTrack
);
}
...
...
@@ -317,7 +320,8 @@ void MainWorkflow::trackUnpaused()
void
MainWorkflow
::
tracksRenderCompleted
(
unsigned
int
trackId
)
{
m_nbTracksToRender
.
fetchAndAddAcquire
(
-
1
);
QMutexLocker
lockNbTracks
(
m_nbTracksToRenderMutex
);
--
m_nbTracksToRender
;
{
QMutexLocker
lock
(
m_highestTrackNumberMutex
);
...
...
src/Workflow/MainWorkflow.h
View file @
87e73d35
...
...
@@ -134,7 +134,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
QMutex
*
m_renderMutex
;
QAtomicInt
m_nbTracksToPause
;
QAtomicInt
m_nbTracksToUnpause
;
QAtomicInt
m_nbTracksToRender
;
unsigned
int
m_nbTracksToRender
;
QMutex
*
m_nbTracksToRenderMutex
;
QMutex
*
m_highestTrackNumberMutex
;
unsigned
int
m_highestTrackNumber
;
unsigned
char
*
m_synchroneRenderingBuffer
;
...
...
src/Workflow/TrackWorkflow.cpp
View file @
87e73d35
...
...
@@ -117,7 +117,7 @@ void TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
{
cw
->
getStateLock
()
->
lockForRead
();
//
qDebug() << "Rendering clip" << cw << "state:" << cw->getState();
qDebug
()
<<
"Rendering clip"
<<
cw
<<
"state:"
<<
cw
->
getState
();
if
(
cw
->
getState
()
==
ClipWorkflow
::
Rendering
)
{
//The rendering state meens... whell it means that the frame is
...
...
@@ -429,6 +429,28 @@ Clip* TrackWorkflow::removeClip( const QUuid& id )
return
NULL
;
}
ClipWorkflow
*
TrackWorkflow
::
removeClipWorkflow
(
const
QUuid
&
id
)
{
QWriteLocker
lock
(
m_clipsLock
);
QMap
<
qint64
,
ClipWorkflow
*>::
iterator
it
=
m_clips
.
begin
();
QMap
<
qint64
,
ClipWorkflow
*>::
iterator
end
=
m_clips
.
end
();
while
(
it
!=
end
)
{
if
(
it
.
value
()
->
getClip
()
->
getUuid
()
==
id
)
{
ClipWorkflow
*
cw
=
it
.
value
();
m_clips
.
erase
(
it
);
computeLength
();
return
cw
;
}
++
it
;
}
return
NULL
;
}
void
TrackWorkflow
::
clipWorkflowRenderCompleted
(
ClipWorkflow
*
cw
)
{
if
(
cw
!=
NULL
)
...
...
src/Workflow/TrackWorkflow.h
View file @
87e73d35
...
...
@@ -57,7 +57,9 @@ class TrackWorkflow : public QObject
void
unpause
();
void
moveClip
(
const
QUuid
&
id
,
qint64
startingFrame
);
Clip
*
removeClip
(
const
QUuid
&
id
);
ClipWorkflow
*
removeClipWorkflow
(
const
QUuid
&
id
);
void
addClip
(
Clip
*
,
qint64
start
);
void
addClip
(
ClipWorkflow
*
,
qint64
start
);
qint64
getClipPosition
(
const
QUuid
&
uuid
)
const
;
Clip
*
getClip
(
const
QUuid
&
uuid
);
...
...
@@ -81,7 +83,6 @@ class TrackWorkflow : public QObject
void
preloadClip
(
ClipWorkflow
*
cw
);
void
stopClipWorkflow
(
ClipWorkflow
*
cw
);
bool
checkEnd
(
qint64
currentFrame
)
const
;
void
addClip
(
ClipWorkflow
*
,
qint64
start
);
void
adjustClipTime
(
qint64
currentFrame
,
qint64
start
,
ClipWorkflow
*
cw
);
...
...
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