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
2bf69dca
Commit
2bf69dca
authored
2 years ago
by
Aline Gondim Santos
Committed by
Sébastien Blin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
misc: fix ut_recorder
GitLab:
#761
Change-Id: Iebcb1dfed3ebd1919c99e00b9528f3e09a77683c
parent
1cc1af80
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/media/media_recorder.cpp
+4
-0
4 additions, 0 deletions
src/media/media_recorder.cpp
src/sip/sipcall.cpp
+12
-12
12 additions, 12 deletions
src/sip/sipcall.cpp
test/unitTest/call/recorder.cpp
+39
-6
39 additions, 6 deletions
test/unitTest/call/recorder.cpp
with
55 additions
and
18 deletions
src/media/media_recorder.cpp
+
4
−
0
View file @
2bf69dca
...
...
@@ -230,6 +230,10 @@ MediaRecorder::addStream(const MediaStream& ms)
JAMI_ERR
()
<<
"Trying to add video stream to audio only recording"
;
return
nullptr
;
}
if
(
ms
.
isVideo
&&
ms
.
format
<
0
)
{
JAMI_ERR
()
<<
"Trying to add invalid video stream to recording"
;
return
nullptr
;
}
auto
ptr
=
std
::
make_unique
<
StreamObserver
>
(
ms
,
[
this
,
...
...
This diff is collapsed.
Click to expand it.
src/sip/sipcall.cpp
+
12
−
12
View file @
2bf69dca
...
...
@@ -1274,10 +1274,9 @@ SIPCall::transfer(const std::string& to)
return
;
}
if
(
Recordable
::
isRecording
())
{
deinit
Record
er
()
;
deinitRecorder
();
if
(
Call
::
is
Record
ing
()
)
stopRecording
();
}
std
::
string
toUri
=
account
->
getToUri
(
to
);
const
pj_str_t
dst
(
CONST_PJ_STR
(
toUri
));
...
...
@@ -2219,10 +2218,10 @@ void
SIPCall
::
stopAllMedia
()
{
JAMI_DBG
(
"[call:%s] Stopping all media"
,
getCallId
().
c_str
());
if
(
Recordable
::
isRecording
())
{
deinit
Record
er
()
;
deinitRecorder
();
if
(
Call
::
is
Record
ing
()
)
stopRecording
();
// if call stops, finish recording
}
#ifdef ENABLE_VIDEO
{
std
::
lock_guard
<
std
::
mutex
>
lk
(
sinksMtx_
);
...
...
@@ -3161,7 +3160,6 @@ SIPCall::toggleRecording()
// add streams to recorder before starting the record
if
(
not
Call
::
isRecording
())
{
updateRecState
(
true
);
auto
account
=
getSIPAccount
();
if
(
!
account
)
{
JAMI_ERR
(
"No account detected"
);
...
...
@@ -3178,15 +3176,17 @@ SIPCall::toggleRecording()
deinitRecorder
();
}
pendingRecord_
=
false
;
return
Call
::
toggleRecording
();
auto
state
=
Call
::
toggleRecording
();
if
(
state
)
updateRecState
(
state
);
return
state
;
}
void
SIPCall
::
deinitRecorder
()
{
if
(
Call
::
isRecording
())
for
(
const
auto
&
rtpSession
:
getRtpSessionList
())
rtpSession
->
deinitRecorder
(
recorder_
);
for
(
const
auto
&
rtpSession
:
getRtpSessionList
())
rtpSession
->
deinitRecorder
(
recorder_
);
}
void
...
...
@@ -3482,7 +3482,7 @@ SIPCall::peerRecording(bool state)
auto
conference
=
conf_
.
lock
();
const
std
::
string
&
id
=
conference
?
conference
->
getConfId
()
:
getCallId
();
if
(
state
)
{
JAMI_WARN
(
"Peer is recording"
);
JAMI_WARN
(
"
[call:%s]
Peer is recording"
,
getCallId
().
c_str
()
);
emitSignal
<
DRing
::
CallSignal
::
RemoteRecordingChanged
>
(
id
,
getPeerNumber
(),
true
);
}
else
{
JAMI_WARN
(
"Peer stopped recording"
);
...
...
This diff is collapsed.
Click to expand it.
test/unitTest/call/recorder.cpp
+
39
−
6
View file @
2bf69dca
...
...
@@ -184,6 +184,18 @@ RecorderTest::testRecordCall()
JAMI_INFO
(
"Start call between Alice and Bob"
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
mediaList
;
std
::
map
<
std
::
string
,
std
::
string
>
mediaAttributeA
=
{{
DRing
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
DRing
::
Media
::
MediaAttributeValue
::
AUDIO
},
{
DRing
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
std
::
map
<
std
::
string
,
std
::
string
>
mediaAttributeV
=
{{
DRing
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
DRing
::
Media
::
MediaAttributeValue
::
VIDEO
},
{
DRing
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
mediaList
.
emplace_back
(
mediaAttributeA
);
mediaList
.
emplace_back
(
mediaAttributeV
);
auto
callId
=
DRing
::
placeCallWithMedia
(
aliceId
,
bobUri
,
mediaList
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
!
bobCall
.
callId
.
empty
();
}));
Manager
::
instance
().
answerCall
(
bobId
,
bobCall
.
callId
);
...
...
@@ -191,15 +203,17 @@ RecorderTest::testRecordCall()
return
bobCall
.
mediaStatus
==
DRing
::
Media
::
MediaNegotiationStatusEvents
::
NEGOTIATION_SUCCESS
;
}));
// give time to start camera
std
::
this_thread
::
sleep_for
(
5s
);
// Start recorder
recordedFile
.
clear
();
CPPUNIT_ASSERT
(
!
DRing
::
getIsRecording
(
aliceId
,
callId
));
DRing
::
toggleRecording
(
aliceId
,
callId
);
// Stop recorder after a few seconds
std
::
this_thread
::
sleep_for
(
5s
);
CPPUNIT_ASSERT
(
DRing
::
getIsRecording
(
aliceId
,
callId
));
recordedFile
.
clear
();
DRing
::
toggleRecording
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
!
DRing
::
getIsRecording
(
aliceId
,
callId
));
...
...
@@ -223,8 +237,7 @@ RecorderTest::testRecordAudioOnlyCall()
=
{{
DRing
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
DRing
::
Media
::
MediaAttributeValue
::
AUDIO
},
{
DRing
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
},
{
DRing
::
Media
::
MediaAttributeKey
::
LABEL
,
"audio_0"
}};
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
mediaList
.
emplace_back
(
mediaAttribute
);
auto
callId
=
DRing
::
placeCallWithMedia
(
aliceId
,
bobUri
,
mediaList
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
!
bobCall
.
callId
.
empty
();
}));
...
...
@@ -235,12 +248,12 @@ RecorderTest::testRecordAudioOnlyCall()
}));
// Start recorder
recordedFile
.
clear
();
DRing
::
toggleRecording
(
aliceId
,
callId
);
// Stop recorder
std
::
this_thread
::
sleep_for
(
5s
);
CPPUNIT_ASSERT
(
DRing
::
getIsRecording
(
aliceId
,
callId
));
recordedFile
.
clear
();
DRing
::
toggleRecording
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
!
DRing
::
getIsRecording
(
aliceId
,
callId
));
...
...
@@ -262,6 +275,18 @@ RecorderTest::testStopCallWhileRecording()
JAMI_INFO
(
"Start call between Alice and Bob"
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
mediaList
;
std
::
map
<
std
::
string
,
std
::
string
>
mediaAttributeA
=
{{
DRing
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
DRing
::
Media
::
MediaAttributeValue
::
AUDIO
},
{
DRing
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
std
::
map
<
std
::
string
,
std
::
string
>
mediaAttributeV
=
{{
DRing
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
DRing
::
Media
::
MediaAttributeValue
::
VIDEO
},
{
DRing
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
mediaList
.
emplace_back
(
mediaAttributeA
);
mediaList
.
emplace_back
(
mediaAttributeV
);
auto
callId
=
DRing
::
placeCallWithMedia
(
aliceId
,
bobUri
,
mediaList
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
!
bobCall
.
callId
.
empty
();
}));
Manager
::
instance
().
answerCall
(
bobId
,
bobCall
.
callId
);
...
...
@@ -269,13 +294,15 @@ RecorderTest::testStopCallWhileRecording()
return
bobCall
.
mediaStatus
==
DRing
::
Media
::
MediaNegotiationStatusEvents
::
NEGOTIATION_SUCCESS
;
}));
// give time to start camera
std
::
this_thread
::
sleep_for
(
5s
);
// Start recorder
recordedFile
.
clear
();
DRing
::
toggleRecording
(
aliceId
,
callId
);
// Hangup call
std
::
this_thread
::
sleep_for
(
5s
);
recordedFile
.
clear
();
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
&&
!
recordedFile
.
empty
();
}));
...
...
@@ -290,9 +317,16 @@ RecorderTest::testDaemonPreference()
auto
bobUri
=
bobAccount
->
getUsername
();
DRing
::
setIsAlwaysRecording
(
true
);
recordedFile
.
clear
();
JAMI_INFO
(
"Start call between Alice and Bob"
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
mediaList
;
std
::
map
<
std
::
string
,
std
::
string
>
mediaAttributeA
=
{{
DRing
::
Media
::
MediaAttributeKey
::
MEDIA_TYPE
,
DRing
::
Media
::
MediaAttributeValue
::
AUDIO
},
{
DRing
::
Media
::
MediaAttributeKey
::
ENABLED
,
TRUE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
MUTED
,
FALSE_STR
},
{
DRing
::
Media
::
MediaAttributeKey
::
SOURCE
,
""
}};
mediaList
.
emplace_back
(
mediaAttributeA
);
auto
callId
=
DRing
::
placeCallWithMedia
(
aliceId
,
bobUri
,
mediaList
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
!
bobCall
.
callId
.
empty
();
}));
Manager
::
instance
().
answerCall
(
bobId
,
bobCall
.
callId
);
...
...
@@ -304,7 +338,6 @@ RecorderTest::testDaemonPreference()
// Let record some seconds
std
::
this_thread
::
sleep_for
(
5s
);
recordedFile
.
clear
();
Manager
::
instance
().
hangupCall
(
aliceId
,
callId
);
CPPUNIT_ASSERT
(
cv
.
wait_for
(
lk
,
20s
,
[
&
]
{
return
bobCall
.
state
==
"OVER"
&&
!
recordedFile
.
empty
();
}));
...
...
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