Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
68a9abcb
Project 'savoirfairelinux/ring-daemon' was moved to 'savoirfairelinux/jami-daemon'. Please update any links and bookmarks that may still have the old path.
Commit
68a9abcb
authored
11 years ago
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
[ #45992 ] Remove unnecessary locks
parent
727dbc99
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/videorenderer.cpp
+7
-28
7 additions, 28 deletions
src/videorenderer.cpp
with
7 additions
and
28 deletions
src/videorenderer.cpp
+
7
−
28
View file @
68a9abcb
...
@@ -80,16 +80,16 @@ bool VideoRenderer::renderToBitmap()
...
@@ -80,16 +80,16 @@ bool VideoRenderer::renderToBitmap()
}
}
if
(
!
shmLock
())
{
if
(
!
shmLock
())
{
return
fals
e
;
return
tru
e
;
}
}
// wait for a new buffer
// wait for a new buffer
while
(
m_BufferGen
==
m_pShmArea
->
m_BufferGen
)
{
while
(
m_BufferGen
==
m_pShmArea
->
m_BufferGen
)
{
shmUnlock
();
shmUnlock
();
const
struct
timespec
timeout
=
createTimeout
();
if
(
!
VideoModel
::
instance
()
->
startStopMutex
()
->
tryLock
())
if
(
!
VideoModel
::
instance
()
->
startStopMutex
()
->
tryLock
())
return
false
;
return
false
;
int
err
=
sem_t
imed
wait
(
&
m_pShmArea
->
notification
,
&
timeout
);
int
err
=
sem_t
ry
wait
(
&
m_pShmArea
->
notification
);
VideoModel
::
instance
()
->
startStopMutex
()
->
unlock
();
VideoModel
::
instance
()
->
startStopMutex
()
->
unlock
();
// Useful for debugging
// Useful for debugging
// switch (errno ) {
// switch (errno ) {
...
@@ -115,11 +115,11 @@ bool VideoRenderer::renderToBitmap()
...
@@ -115,11 +115,11 @@ bool VideoRenderer::renderToBitmap()
// break;
// break;
// }
// }
if
(
err
<
0
)
{
if
(
err
<
0
)
{
return
false
;
return
errno
==
EAGAIN
;
}
}
if
(
!
shmLock
())
{
if
(
!
shmLock
())
{
return
fals
e
;
return
tru
e
;
}
}
}
}
...
@@ -208,7 +208,7 @@ bool VideoRenderer::resizeShm()
...
@@ -208,7 +208,7 @@ bool VideoRenderer::resizeShm()
m_ShmAreaLen
=
new_size
;
m_ShmAreaLen
=
new_size
;
if
(
!
shmLock
())
if
(
!
shmLock
())
return
fals
e
;
return
tru
e
;
}
}
return
true
;
return
true
;
}
}
...
@@ -217,14 +217,7 @@ bool VideoRenderer::resizeShm()
...
@@ -217,14 +217,7 @@ bool VideoRenderer::resizeShm()
bool
VideoRenderer
::
shmLock
()
bool
VideoRenderer
::
shmLock
()
{
{
#ifdef Q_OS_LINUX
#ifdef Q_OS_LINUX
const
timespec
timeout
=
createTimeout
();
return
sem_trywait
(
&
m_pShmArea
->
mutex
)
>=
0
;
/* We need an upper limit on how long we'll wait to avoid locking the whole GUI */
if
(
sem_timedwait
(
&
m_pShmArea
->
mutex
,
&
timeout
)
<
0
)
{
if
(
errno
==
ETIMEDOUT
)
qDebug
()
<<
"Timed out before shm lock was acquired"
;
return
false
;
}
return
true
;
#else
#else
return
false
;
return
false
;
#endif
#endif
...
@@ -236,20 +229,6 @@ void VideoRenderer::shmUnlock()
...
@@ -236,20 +229,6 @@ void VideoRenderer::shmUnlock()
sem_post
(
&
m_pShmArea
->
mutex
);
sem_post
(
&
m_pShmArea
->
mutex
);
}
}
///Create a SHM timeout
timespec
VideoRenderer
::
createTimeout
()
{
#ifdef Q_OS_LINUX
timespec
timeout
=
{
0
,
0
};
if
(
clock_gettime
(
CLOCK_REALTIME
,
&
timeout
)
==
-
1
)
qDebug
()
<<
"clock_gettime"
;
timeout
.
tv_sec
+=
TIMEOUT_SEC
;
return
timeout
;
#else
return
{
0
,
0
};
#endif
}
/*****************************************************************************
/*****************************************************************************
* *
* *
...
...
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