summaryrefslogtreecommitdiffstats
path: root/cmds/screenrecord/screenrecord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/screenrecord/screenrecord.cpp')
-rw-r--r--cmds/screenrecord/screenrecord.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp
index b13333c..a6652f4 100644
--- a/cmds/screenrecord/screenrecord.cpp
+++ b/cmds/screenrecord/screenrecord.cpp
@@ -45,6 +45,7 @@
#include <signal.h>
#include <getopt.h>
#include <sys/wait.h>
+#include <assert.h>
#include "screenrecord.h"
#include "Overlay.h"
@@ -532,9 +533,10 @@ static status_t recordScreen(const char* fileName) {
// Configure optional overlay.
sp<IGraphicBufferProducer> bufferProducer;
- sp<Overlay> overlay = new Overlay();
+ sp<Overlay> overlay;
if (gWantFrameTime) {
// Send virtual display frames to an external texture.
+ overlay = new Overlay();
err = overlay->start(encoderInputSurface, &bufferProducer);
if (err != NO_ERROR) {
encoder->release();
@@ -578,7 +580,9 @@ static status_t recordScreen(const char* fileName) {
// Shut everything down, starting with the producer side.
encoderInputSurface = NULL;
SurfaceComposerClient::destroyDisplay(dpy);
- overlay->stop();
+ if (overlay != NULL) {
+ overlay->stop();
+ }
encoder->stop();
// If we don't stop muxer explicitly, i.e. let the destructor run,
// it may hang (b/11050628).