Merge lp:~schwann/qtubuntu-camera/camera-fast-finger-corrupt into lp:qtubuntu-camera

Proposed by Günter Schwann
Status: Merged
Approved by: Günter Schwann
Approved revision: 64
Merged at revision: 64
Proposed branch: lp:~schwann/qtubuntu-camera/camera-fast-finger-corrupt
Merge into: lp:qtubuntu-camera
Diff against target: 71 lines (+11/-6)
2 files modified
src/aalvideorenderercontrol.cpp (+10/-5)
src/aalvideorenderercontrol.h (+1/-1)
To merge this branch: bzr merge lp:~schwann/qtubuntu-camera/camera-fast-finger-corrupt
Reviewer Review Type Date Requested Status
Thomas Moenicke (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+175591@code.launchpad.net

Commit message

The camera needs some frames to be ready for capture LP: #1125302

Description of the change

The camera needs some frames to be ready for capture LP: #1125302

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomas Moenicke (thomas-moenicke) wrote :

good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/aalvideorenderercontrol.cpp'
2--- src/aalvideorenderercontrol.cpp 2013-06-21 10:24:02 +0000
3+++ src/aalvideorenderercontrol.cpp 2013-07-18 14:33:37 +0000
4@@ -29,6 +29,8 @@
5 #include <QUrl>
6 #include <QVideoSurfaceFormat>
7
8+const int MIN_FRAME_COUNT = 8; // minimal number of frames to be ready for capture
9+
10 class AalGLTextureBuffer : public QAbstractVideoBuffer
11 {
12 public:
13@@ -71,7 +73,7 @@
14 m_service(service),
15 m_viewFinderRunning(false),
16 m_textureId(0),
17- m_firstFrame(true)
18+ m_frameCount(0)
19 {
20 // Get notified when qtvideo-node creates a GL texture
21 connect(SharedSignal::instance(), SIGNAL(textureCreated(unsigned int)), this, SLOT(onTextureCreated(unsigned int)));
22@@ -130,6 +132,7 @@
23 m_surface->stop();
24
25 m_viewFinderRunning = false;
26+ m_frameCount = 0;
27
28 m_service->updateCaptureReady();
29 }
30@@ -139,7 +142,7 @@
31 // m_textureId can be (and will be) 0 if this is the first video frame since this
32 // is how a ShaderVideoNode instance gets created and ultimately how m_textureId
33 // get set.
34- if (!m_surface || (!m_textureId && !m_firstFrame) || !m_service->androidControl())
35+ if (!m_surface || (!m_textureId && !m_frameCount==0) || !m_service->androidControl())
36 return;
37
38 QSize vfSize = m_service->viewfinderControl()->currentSize();
39@@ -163,8 +166,10 @@
40 m_surface->present(frame);
41 }
42
43- if (m_firstFrame)
44- m_firstFrame = false;
45+ ++m_frameCount;
46+ if (m_frameCount == MIN_FRAME_COUNT) {
47+ m_service->updateCaptureReady();
48+ }
49 }
50
51 void AalVideoRendererControl::onTextureCreated(GLuint textureID)
52@@ -202,5 +207,5 @@
53
54 bool AalVideoRendererControl::isViewfinderRunning() const
55 {
56- return m_viewFinderRunning;
57+ return m_viewFinderRunning && m_frameCount >= MIN_FRAME_COUNT;
58 }
59
60=== modified file 'src/aalvideorenderercontrol.h'
61--- src/aalvideorenderercontrol.h 2013-06-21 10:24:02 +0000
62+++ src/aalvideorenderercontrol.h 2013-07-18 14:33:37 +0000
63@@ -64,7 +64,7 @@
64 GLuint m_textureId;
65 QImage m_preview;
66
67- bool m_firstFrame;
68+ int m_frameCount;
69 };
70
71 #endif

Subscribers

People subscribed via source and target branches