Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
acf42c05
Commit
acf42c05
authored
6 years ago
by
Philippe Gorley
Committed by
Philippe Gorley
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test: add resampler test case
Change-Id: I0f8f9571a715fe26a7db61a43675efc50ce71564
parent
7cb6ddea
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/unitTest/media/audio/test_resampler.cpp
+30
-5
30 additions, 5 deletions
test/unitTest/media/audio/test_resampler.cpp
with
30 additions
and
5 deletions
test/unitTest/media/audio/test_resampler.cpp
+
30
−
5
View file @
acf42c05
...
...
@@ -23,6 +23,7 @@
#include
<cppunit/extensions/HelperMacros.h>
#include
"dring.h"
#include
"videomanager_interface.h"
#include
"libav_deps.h"
#include
"audio/resampler.h"
...
...
@@ -38,10 +39,12 @@ public:
void
tearDown
();
private
:
void
testResample
();
void
testAudioBuffer
();
void
testAudioFrame
();
CPPUNIT_TEST_SUITE
(
ResamplerTest
);
CPPUNIT_TEST
(
testResample
);
CPPUNIT_TEST
(
testAudioBuffer
);
CPPUNIT_TEST
(
testAudioFrame
);
CPPUNIT_TEST_SUITE_END
();
std
::
unique_ptr
<
Resampler
>
resampler_
;
...
...
@@ -53,7 +56,6 @@ void
ResamplerTest
::
setUp
()
{
DRing
::
init
(
DRing
::
InitFlag
(
DRing
::
DRING_FLAG_DEBUG
|
DRing
::
DRING_FLAG_CONSOLE_LOG
));
libav_utils
::
ring_avcodec_init
();
}
void
...
...
@@ -63,9 +65,8 @@ ResamplerTest::tearDown()
}
void
ResamplerTest
::
test
Resample
()
ResamplerTest
::
test
AudioBuffer
()
{
const
constexpr
AudioFormat
none
(
0
,
0
);
const
constexpr
AudioFormat
infmt
(
44100
,
1
);
const
constexpr
AudioFormat
outfmt
(
48000
,
2
);
...
...
@@ -79,6 +80,30 @@ ResamplerTest::testResample()
CPPUNIT_ASSERT
(
outbuf
.
getFormat
().
nb_channels
==
2
);
}
void
ResamplerTest
::
testAudioFrame
()
{
const
constexpr
AudioFormat
infmt
(
44100
,
1
);
resampler_
.
reset
(
new
Resampler
);
AudioBuffer
inbuf
(
1024
,
infmt
);
auto
input
=
inbuf
.
toAVFrame
();
CPPUNIT_ASSERT
(
input
->
data
&&
input
->
data
[
0
]);
CPPUNIT_ASSERT
(
input
->
data
[
0
][
0
]
==
0
);
DRing
::
AudioFrame
out
;
auto
output
=
out
.
pointer
();
output
->
format
=
AV_SAMPLE_FMT_FLT
;
output
->
sample_rate
=
48000
;
output
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
int
ret
=
resampler_
->
resample
(
input
,
output
);
CPPUNIT_ASSERT_MESSAGE
(
libav_utils
::
getError
(
ret
).
c_str
(),
ret
>=
0
);
CPPUNIT_ASSERT
(
output
->
data
&&
output
->
data
[
0
]);
CPPUNIT_ASSERT
(
output
->
data
[
0
][
0
]
==
0
);
}
}}
// namespace ring::test
RING_TEST_RUNNER
(
ring
::
test
::
ResamplerTest
::
name
());
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment