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
cb55e676
Commit
cb55e676
authored
Mar 21, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/components/camera/Camera): try to limit cpu usage
parent
b04ab273
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
Camera.cpp
linphone-desktop/src/components/camera/Camera.cpp
+10
-11
Camera.hpp
linphone-desktop/src/components/camera/Camera.hpp
+2
-0
No files found.
linphone-desktop/src/components/camera/Camera.cpp
View file @
cb55e676
...
...
@@ -27,13 +27,14 @@
#include "Camera.hpp"
#include <QFileInfo>
#include <QThread>
#include <QQuickWindow>
#include <QThread>
#include <QTimer>
// =============================================================================
struct
CameraStateBinder
{
CameraStateBinder
(
CameraRenderer
*
renderer
)
:
m_renderer
(
renderer
)
{
CameraStateBinder
()
{
QOpenGLFunctions
*
f
=
QOpenGLContext
::
currentContext
()
->
functions
();
f
->
glEnable
(
GL_DEPTH_TEST
);
...
...
@@ -49,12 +50,7 @@ struct CameraStateBinder {
f
->
glDisable
(
GL_CULL_FACE
);
f
->
glDisable
(
GL_DEPTH_TEST
);
// Process at next tick.
m_renderer
->
update
();
}
CameraRenderer
*
m_renderer
;
};
// -----------------------------------------------------------------------------
...
...
@@ -97,7 +93,7 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &
}
void
CameraRenderer
::
render
()
{
CameraStateBinder
state
(
this
)
;
CameraStateBinder
state
;
if
(
!
m_linphone_call
)
return
;
...
...
@@ -140,9 +136,6 @@ void CameraRenderer::synchronize (QQuickFramebufferObject *item) {
}
void
CameraRenderer
::
updateWindowId
()
{
qInfo
()
<<
"Thread"
<<
QThread
::
currentThread
()
<<
QStringLiteral
(
"Set context info (width: %1, height: %2, is_preview: %3)."
)
.
arg
(
m_context_info
->
width
).
arg
(
m_context_info
->
height
).
arg
(
m_is_preview
);
if
(
m_is_preview
)
CoreManager
::
getInstance
()
->
getCore
()
->
setNativePreviewWindowId
(
m_context_info
);
else
if
(
m_linphone_call
)
...
...
@@ -157,6 +150,12 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
// The fbo content must be y-mirrored because the ms rendering is y-inverted.
setMirrorVertically
(
true
);
m_refresh_timer
=
new
QTimer
(
this
);
m_refresh_timer
->
setInterval
(
1
/
60
*
1000
);
QObject
::
connect
(
m_refresh_timer
,
&
QTimer
::
timeout
,
this
,
&
QQuickFramebufferObject
::
update
);
m_refresh_timer
->
start
();
}
QQuickFramebufferObject
::
Renderer
*
Camera
::
createRenderer
()
const
{
...
...
linphone-desktop/src/components/camera/Camera.hpp
View file @
cb55e676
...
...
@@ -89,6 +89,8 @@ private:
bool
m_is_preview
=
false
;
CallModel
*
m_call
=
nullptr
;
QTimer
*
m_refresh_timer
;
};
#endif // CAMERA_H_
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