Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
cec85438
Commit
cec85438
authored
Dec 26, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
It works a bit better for the audio.
parent
06f52598
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
18 deletions
+25
-18
src/Workflow/AudioClipWorkflow.cpp
src/Workflow/AudioClipWorkflow.cpp
+20
-7
src/Workflow/AudioClipWorkflow.h
src/Workflow/AudioClipWorkflow.h
+2
-1
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+0
-2
src/Workflow/VideoClipWorkflow.cpp
src/Workflow/VideoClipWorkflow.cpp
+3
-8
No files found.
src/Workflow/AudioClipWorkflow.cpp
View file @
cec85438
...
...
@@ -83,21 +83,35 @@ void AudioClipWorkflow::initVlcOutput()
m_vlcMedia
->
addOption
(
":no-sout-smem-time-sync"
);
}
AudioClipWorkflow
::
AudioSample
*
AudioClipWorkflow
::
createBuffer
(
size_t
size
)
{
AudioSample
*
as
=
new
AudioSample
;
as
->
buff
=
new
uchar
[
size
];
as
->
size
=
size
;
return
as
;
}
void
AudioClipWorkflow
::
lock
(
AudioClipWorkflow
*
cw
,
uint8_t
**
pcm_buffer
,
unsigned
int
size
)
{
cw
->
m_renderLock
->
lock
();
//If there's no buffer at all, it must be the first render
if
(
cw
->
m_availableBuffers
.
count
()
==
0
&&
cw
->
m_computedBuffers
.
count
()
==
0
)
{
for
(
unsigned
int
i
=
0
;
i
<
AudioClipWorkflow
::
nbBuffers
;
++
i
)
{
AudioSample
*
as
=
new
AudioSample
;
as
->
buff
=
new
uchar
[
size
];
as
->
size
=
size
;
AudioSample
*
as
=
cw
->
createBuffer
(
size
);
cw
->
m_availableBuffers
.
push_back
(
as
);
}
}
cw
->
m_renderLock
->
lock
();
AudioSample
*
as
=
cw
->
m_availableBuffers
.
pop
();
qWarning
()
<<
">>>AudioGeneration. Available:"
<<
cw
->
m_availableBuffers
.
count
()
<<
"Computed:"
<<
cw
->
m_computedBuffers
.
count
();
AudioSample
*
as
=
NULL
;
if
(
cw
->
m_availableBuffers
.
isEmpty
()
==
true
)
{
qCritical
()
<<
cw
<<
"Late buffer generation ! Spawning new buffer."
;
as
=
cw
->
createBuffer
(
size
);
}
else
as
=
cw
->
m_availableBuffers
.
pop
();
cw
->
m_computedBuffers
.
push_back
(
as
);
*
pcm_buffer
=
as
->
buff
;
}
...
...
@@ -122,9 +136,8 @@ void AudioClipWorkflow::unlock( AudioClipWorkflow* cw, uint8_t* pcm_buffe
as
->
nbChannels
=
channels
;
as
->
ptsDiff
=
cw
->
m_currentPts
-
cw
->
m_previousPts
;
}
cw
->
m_renderLock
->
unlock
();
cw
->
commonUnlock
();
cw
->
m_renderLock
->
unlock
();
}
uint32_t
AudioClipWorkflow
::
getAvailableBuffers
()
const
...
...
src/Workflow/AudioClipWorkflow.h
View file @
cec85438
...
...
@@ -54,6 +54,7 @@ class AudioClipWorkflow : public ClipWorkflow
QReadWriteLock
*
m_availableBuffersLock
;
Pool
<
AudioSample
*>
m_availableBuffers
;
void
initVlcOutput
();
AudioSample
*
createBuffer
(
size_t
size
);
static
void
lock
(
AudioClipWorkflow
*
clipWorkflow
,
uint8_t
**
pcm_buffer
,
unsigned
int
size
);
static
void
unlock
(
AudioClipWorkflow
*
clipWorkflow
,
uint8_t
*
pcm_buffer
,
unsigned
int
channels
,
unsigned
int
rate
,
...
...
@@ -61,7 +62,7 @@ class AudioClipWorkflow : public ClipWorkflow
unsigned
int
size
,
qint64
pts
);
//FIXME: this is totally random powered ! Please adjust with a value that does make sense...
static
const
uint32_t
nbBuffers
=
1
28
;
static
const
uint32_t
nbBuffers
=
1
024
;
};
#endif // AUDIOCLIPWORKFLOW_H
src/Workflow/ClipWorkflow.cpp
View file @
cec85438
...
...
@@ -227,13 +227,11 @@ void ClipWorkflow::commonUnlock()
}
if
(
getComputedBuffers
()
==
1
)
{
qDebug
()
<<
"trying to inform of first buffer"
;
QMutexLocker
lock
(
m_feedingCondWait
->
getMutex
()
);
qWarning
()
<<
"Just rendered the first buffer."
;
m_feedingCondWait
->
wake
();
}
checkStateChange
();
qDebug
()
<<
"exited from common unlock"
;
}
void
ClipWorkflow
::
computePtsDiff
(
qint64
pts
)
...
...
src/Workflow/VideoClipWorkflow.cpp
View file @
cec85438
...
...
@@ -89,7 +89,7 @@ void* VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
QMutexLocker
lock
(
m_renderLock
);
preGetOutput
();
qWarning
()
<<
"Video. Available:"
<<
m_availableBuffers
.
count
()
<<
"Computed:"
<<
m_computedBuffers
.
count
();
//
qWarning() << "Video. Available:" << m_availableBuffers.count() << "Computed:" << m_computedBuffers.count();
if
(
isEndReached
()
==
true
)
return
NULL
;
StackedBuffer
<
LightVideoFrame
*>*
buff
;
...
...
@@ -97,19 +97,17 @@ void* VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
buff
=
new
StackedBuffer
<
LightVideoFrame
*>
(
m_computedBuffers
.
pop
(),
&
m_availableBuffers
,
true
);
else
if
(
mode
==
ClipWorkflow
::
Get
)
buff
=
new
StackedBuffer
<
LightVideoFrame
*>
(
m_computedBuffers
.
head
(),
NULL
,
false
);
ClipWorkflow
::
postGetOutput
();
postGetOutput
();
return
buff
;
}
void
VideoClipWorkflow
::
lock
(
VideoClipWorkflow
*
cw
,
void
**
pp_ret
,
int
size
)
{
Q_UNUSED
(
size
);
qDebug
()
<<
"trying to lock renderlock"
;
cw
->
m_renderLock
->
lock
();
qDebug
()
<<
"trying to pop available buffer"
;
LightVideoFrame
*
lvf
=
cw
->
m_availableBuffers
.
pop
();
cw
->
m_computedBuffers
.
push_back
(
lvf
);
qWarning
()
<<
">>>VideoGeneration. Available:"
<<
cw
->
m_availableBuffers
.
count
()
<<
"Computed:"
<<
cw
->
m_computedBuffers
.
count
();
//
qWarning() << ">>>VideoGeneration. Available:" << cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
// qWarning() << "feeding video buffer";
*
pp_ret
=
(
*
(
lvf
))
->
frame
.
octets
;
}
...
...
@@ -123,13 +121,10 @@ void VideoClipWorkflow::unlock( VideoClipWorkflow* cw, void* buffer, int widt
Q_UNUSED
(
size
);
cw
->
computePtsDiff
(
pts
);
qDebug
()
<<
"getting computed buffers head"
;
LightVideoFrame
*
lvf
=
cw
->
m_computedBuffers
.
head
();
(
*
(
lvf
))
->
ptsDiff
=
cw
->
m_currentPts
-
cw
->
m_previousPts
;
//If this is the first buffer that has been rendered, there may be a waiting TrackWorkflow.
qDebug
()
<<
"calling commonUnlock"
;
cw
->
commonUnlock
();
qDebug
()
<<
"unlocking render lock"
;
cw
->
m_renderLock
->
unlock
();
}
...
...
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