Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
327c439f
Commit
327c439f
authored
Oct 22, 2013
by
Derek Buitenhuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
timefilter: Handle memory allocation failure
Signed-off-by:
Derek Buitenhuis
<
derek.buitenhuis@gmail.com
>
parent
e7891305
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
jack_audio.c
libavdevice/jack_audio.c
+4
-0
timefilter.c
libavdevice/timefilter.c
+9
-1
timefilter.h
libavdevice/timefilter.h
+2
-0
No files found.
libavdevice/jack_audio.c
View file @
327c439f
...
...
@@ -190,6 +190,10 @@ static int start_jack(AVFormatContext *context)
period
=
(
double
)
self
->
buffer_size
/
self
->
sample_rate
;
o
=
2
*
M_PI
*
1
.
5
*
period
;
/// bandwidth: 1.5Hz
self
->
timefilter
=
ff_timefilter_new
(
1
.
0
/
self
->
sample_rate
,
sqrt
(
2
*
o
),
o
*
o
);
if
(
!
self
->
timefilter
)
{
jack_client_close
(
self
->
client
);
return
AVERROR
(
ENOMEM
);
}
/* Create FIFO buffers */
self
->
filled_pkts
=
av_fifo_alloc
(
FIFO_PACKETS_NUM
*
sizeof
(
AVPacket
));
...
...
libavdevice/timefilter.c
View file @
327c439f
...
...
@@ -41,7 +41,11 @@ TimeFilter *ff_timefilter_new(double clock_period,
double
feedback2_factor
,
double
feedback3_factor
)
{
TimeFilter
*
self
=
av_mallocz
(
sizeof
(
TimeFilter
));
TimeFilter
*
self
=
av_mallocz
(
sizeof
(
TimeFilter
));
if
(
!
self
)
return
NULL
;
self
->
clock_period
=
clock_period
;
self
->
feedback2_factor
=
feedback2_factor
;
self
->
feedback3_factor
=
feedback3_factor
;
...
...
@@ -105,6 +109,10 @@ int main(void)
for
(
par1
=
bestpar1
*
0
.
8
;
par1
<=
bestpar1
*
1
.
21
;
par1
+=
bestpar1
*
0
.
05
)
{
double
error
=
0
;
TimeFilter
*
tf
=
ff_timefilter_new
(
1
,
par0
,
par1
);
if
(
!
tf
)
{
printf
(
"Could not allocate memory for timefilter.
\n
"
);
exit
(
1
);
}
for
(
i
=
0
;
i
<
SAMPLES
;
i
++
)
{
double
filtered
;
filtered
=
ff_timefilter_update
(
tf
,
samples
[
i
],
1
);
...
...
libavdevice/timefilter.h
View file @
327c439f
...
...
@@ -56,6 +56,8 @@ typedef struct TimeFilter TimeFilter;
* @param clock_period period of the hardware clock in seconds
* (for example 1.0/44100)
*
* @return a pointer to a TimeFilter struct, or NULL on error
*
* For more details about these parameters and background concepts please see:
* http://www.kokkinizita.net/papers/usingdll.pdf
*/
...
...
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