Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
linphone-desktop
Commits
ab4efe77
Commit
ab4efe77
authored
Jun 16, 2017
by
Wescoeur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(SoundPlayer): handle ringer device change
parent
d4e1adca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
+41
-12
SoundPlayer.cpp
src/components/sound-player/SoundPlayer.cpp
+36
-12
SoundPlayer.hpp
src/components/sound-player/SoundPlayer.hpp
+5
-0
No files found.
src/components/sound-player/SoundPlayer.cpp
View file @
ab4efe77
...
@@ -64,8 +64,7 @@ SoundPlayer::SoundPlayer (QObject *parent) : QObject(parent) {
...
@@ -64,8 +64,7 @@ SoundPlayer::SoundPlayer (QObject *parent) : QObject(parent) {
mHandlers
=
make_shared
<
SoundPlayer
::
Handlers
>
(
this
);
mHandlers
=
make_shared
<
SoundPlayer
::
Handlers
>
(
this
);
mInternalPlayer
=
CoreManager
::
getInstance
()
->
getCore
()
->
createLocalPlayer
(
""
,
""
,
nullptr
);
buildInternalPlayer
();
mInternalPlayer
->
setListener
(
mHandlers
);
}
}
SoundPlayer
::~
SoundPlayer
()
{
SoundPlayer
::~
SoundPlayer
()
{
...
@@ -117,16 +116,7 @@ void SoundPlayer::play () {
...
@@ -117,16 +116,7 @@ void SoundPlayer::play () {
}
}
void
SoundPlayer
::
stop
()
{
void
SoundPlayer
::
stop
()
{
if
(
mPlaybackState
==
SoundPlayer
::
StoppedState
)
stop
(
false
);
return
;
mForceCloseTimer
->
stop
();
mPlaybackState
=
SoundPlayer
::
StoppedState
;
mInternalPlayer
->
close
();
emit
stopped
();
emit
playbackStateChanged
(
mPlaybackState
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -143,6 +133,40 @@ int SoundPlayer::getPosition () const {
...
@@ -143,6 +133,40 @@ int SoundPlayer::getPosition () const {
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
SoundPlayer
::
buildInternalPlayer
()
{
CoreManager
*
coreManager
=
CoreManager
::
getInstance
();
SettingsModel
*
settingsModel
=
coreManager
->
getSettingsModel
();
mInternalPlayer
=
coreManager
->
getCore
()
->
createLocalPlayer
(
::
Utils
::
appStringToCoreString
(
settingsModel
->
getRingerDevice
()),
""
,
nullptr
);
mInternalPlayer
->
setListener
(
mHandlers
);
QObject
::
connect
(
settingsModel
,
&
SettingsModel
::
ringerDeviceChanged
,
this
,
[
this
]
{
rebuildInternalPlayer
();
});
}
void
SoundPlayer
::
rebuildInternalPlayer
()
{
stop
(
true
);
buildInternalPlayer
();
}
void
SoundPlayer
::
stop
(
bool
force
)
{
if
(
mPlaybackState
==
SoundPlayer
::
StoppedState
&&
!
force
)
return
;
mForceCloseTimer
->
stop
();
mPlaybackState
=
SoundPlayer
::
StoppedState
;
mInternalPlayer
->
close
();
emit
stopped
();
emit
playbackStateChanged
(
mPlaybackState
);
}
// -----------------------------------------------------------------------------
void
SoundPlayer
::
handleEof
()
{
void
SoundPlayer
::
handleEof
()
{
mForceCloseMutex
.
lock
();
mForceCloseMutex
.
lock
();
...
...
src/components/sound-player/SoundPlayer.hpp
View file @
ab4efe77
...
@@ -76,6 +76,11 @@ signals:
...
@@ -76,6 +76,11 @@ signals:
void
playbackStateChanged
(
PlaybackState
playbackState
);
void
playbackStateChanged
(
PlaybackState
playbackState
);
private:
private:
void
buildInternalPlayer
();
void
rebuildInternalPlayer
();
void
stop
(
bool
force
);
void
handleEof
();
void
handleEof
();
void
setError
(
const
QString
&
message
);
void
setError
(
const
QString
&
message
);
...
...
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