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
97786ec0
Commit
97786ec0
authored
6 years ago
by
Philippe Gorley
Committed by
Adrien Béraud
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test: fix audio frame resizer test cases
Change-Id: Ifd62420e19831bb2736248a8ada706429ab5fabc
parent
c79897cc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/unitTest/media/audio/test_audio_frame_resizer.cpp
+10
-10
10 additions, 10 deletions
test/unitTest/media/audio/test_audio_frame_resizer.cpp
with
10 additions
and
10 deletions
test/unitTest/media/audio/test_audio_frame_resizer.cpp
+
10
−
10
View file @
97786ec0
...
...
@@ -44,8 +44,8 @@ private:
void
testBiggerOutput
();
void
testDifferentFormat
();
void
gotFrame
(
std
::
unique
_ptr
<
AudioFrame
>&&
framePtr
);
std
::
unique
_ptr
<
AudioFrame
>
getFrame
(
int
n
);
void
gotFrame
(
std
::
shared
_ptr
<
AudioFrame
>&&
framePtr
);
std
::
shared
_ptr
<
AudioFrame
>
getFrame
(
int
n
);
CPPUNIT_TEST_SUITE
(
AudioFrameResizerTest
);
CPPUNIT_TEST
(
testSameSize
);
...
...
@@ -54,7 +54,7 @@ private:
CPPUNIT_TEST
(
testDifferentFormat
);
CPPUNIT_TEST_SUITE_END
();
std
::
unique
_ptr
<
AudioFrameResizer
>
q_
;
std
::
shared
_ptr
<
AudioFrameResizer
>
q_
;
AudioFormat
format_
=
AudioFormat
::
STEREO
();
int
outputSize_
=
960
;
};
...
...
@@ -62,16 +62,16 @@ private:
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
AudioFrameResizerTest
,
AudioFrameResizerTest
::
name
());
void
AudioFrameResizerTest
::
gotFrame
(
std
::
unique
_ptr
<
AudioFrame
>&&
framePtr
)
AudioFrameResizerTest
::
gotFrame
(
std
::
shared
_ptr
<
AudioFrame
>&&
framePtr
)
{
CPPUNIT_ASSERT
(
framePtr
&&
framePtr
->
pointer
());
CPPUNIT_ASSERT
(
framePtr
->
pointer
()
->
nb_samples
==
outputSize_
);
}
std
::
unique
_ptr
<
AudioFrame
>
std
::
shared
_ptr
<
AudioFrame
>
AudioFrameResizerTest
::
getFrame
(
int
n
)
{
auto
frame
=
std
::
make_
unique
<
AudioFrame
>
();
auto
frame
=
std
::
make_
shared
<
AudioFrame
>
();
frame
->
pointer
()
->
format
=
format_
.
sampleFormat
;
frame
->
pointer
()
->
sample_rate
=
format_
.
sample_rate
;
frame
->
pointer
()
->
channels
=
format_
.
nb_channels
;
...
...
@@ -85,7 +85,7 @@ void
AudioFrameResizerTest
::
testSameSize
()
{
// input.nb_samples == output.nb_samples
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
unique
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
shared
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
auto
in
=
getFrame
(
outputSize_
);
// gotFrame should be called after this
CPPUNIT_ASSERT_NO_THROW
(
q_
->
enqueue
(
std
::
move
(
in
)));
...
...
@@ -96,7 +96,7 @@ void
AudioFrameResizerTest
::
testBiggerInput
()
{
// input.nb_samples > output.nb_samples
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
unique
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
shared
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
auto
in
=
getFrame
(
outputSize_
+
100
);
// gotFrame should be called after this
CPPUNIT_ASSERT_NO_THROW
(
q_
->
enqueue
(
std
::
move
(
in
)));
...
...
@@ -107,7 +107,7 @@ void
AudioFrameResizerTest
::
testBiggerOutput
()
{
// input.nb_samples < output.nb_samples
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
unique
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
shared
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
auto
in
=
getFrame
(
outputSize_
-
100
);
CPPUNIT_ASSERT_NO_THROW
(
q_
->
enqueue
(
std
::
move
(
in
)));
CPPUNIT_ASSERT
(
q_
->
samples
()
==
outputSize_
-
100
);
...
...
@@ -121,7 +121,7 @@ void
AudioFrameResizerTest
::
testDifferentFormat
()
{
// frame format != q_->format_
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
unique
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
q_
.
reset
(
new
AudioFrameResizer
(
format_
,
outputSize_
,
[
this
](
std
::
shared
_ptr
<
AudioFrame
>&&
f
){
gotFrame
(
std
::
move
(
f
));
}));
auto
in
=
getFrame
(
960
);
// XXX this should never be done, but use this as a shortcut for this test case
in
->
pointer
()
->
channels
=
1
;
...
...
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