Loading cmds/screenrecord/Overlay.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,11 @@ void Overlay::getTimeString_l(nsecs_t monotonicNsec, char* buf, size_t bufLen) { const char* format = "%T"; struct tm tm; if (mUseMonotonicTimestamps) { snprintf(buf, bufLen, "%" PRId64, monotonicNsec); return; } // localtime/strftime is not the fastest way to do this, but a trivial // benchmark suggests that the cost is negligible. int64_t realTime = mStartRealtimeNsecs + Loading cmds/screenrecord/Overlay.h +5 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ namespace android { */ class Overlay : public GLConsumer::FrameAvailableListener, Thread { public: Overlay() : Thread(false), Overlay(bool monotonicTimestamps) : Thread(false), mThreadResult(UNKNOWN_ERROR), mState(UNINITIALIZED), mFrameAvailable(false), Loading @@ -45,7 +45,8 @@ public: mStartMonotonicNsecs(0), mStartRealtimeNsecs(0), mLastFrameNumber(-1), mTotalDroppedFrames(0) mTotalDroppedFrames(0), mUseMonotonicTimestamps(monotonicTimestamps) {} // Creates a thread that performs the overlay. Pass in the surface that Loading Loading @@ -151,6 +152,8 @@ private: nsecs_t mLastFrameNumber; size_t mTotalDroppedFrames; bool mUseMonotonicTimestamps; static const char* kPropertyNames[]; }; Loading cmds/screenrecord/screenrecord.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ static const char* kMimeTypeAvc = "video/avc"; // Command-line parameters. static bool gVerbose = false; // chatty on stdout static bool gRotate = false; // rotate 90 degrees static bool gMonotonicTime = false; // use system monotonic time for timestamps static enum { FORMAT_MP4, FORMAT_H264, FORMAT_FRAMES, FORMAT_RAW_FRAMES } gOutputFormat = FORMAT_MP4; // data format for output Loading Loading @@ -609,7 +610,7 @@ static status_t recordScreen(const char* fileName) { sp<Overlay> overlay; if (gWantFrameTime) { // Send virtual display frames to an external texture. overlay = new Overlay(); overlay = new Overlay(gMonotonicTime); err = overlay->start(encoderInputSurface, &bufferProducer); if (err != NO_ERROR) { if (encoder != NULL) encoder->release(); Loading Loading @@ -892,6 +893,7 @@ int main(int argc, char* const argv[]) { { "show-frame-time", no_argument, NULL, 'f' }, { "rotate", no_argument, NULL, 'r' }, { "output-format", required_argument, NULL, 'o' }, { "monotonic-time", no_argument, NULL, 'm' }, { NULL, 0, NULL, 0 } }; Loading Loading @@ -971,6 +973,9 @@ int main(int argc, char* const argv[]) { return 2; } break; case 'm': gMonotonicTime = true; break; default: if (ic != '?') { fprintf(stderr, "getopt_long returned unexpected value 0x%x\n", ic); Loading Loading
cmds/screenrecord/Overlay.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,11 @@ void Overlay::getTimeString_l(nsecs_t monotonicNsec, char* buf, size_t bufLen) { const char* format = "%T"; struct tm tm; if (mUseMonotonicTimestamps) { snprintf(buf, bufLen, "%" PRId64, monotonicNsec); return; } // localtime/strftime is not the fastest way to do this, but a trivial // benchmark suggests that the cost is negligible. int64_t realTime = mStartRealtimeNsecs + Loading
cmds/screenrecord/Overlay.h +5 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ namespace android { */ class Overlay : public GLConsumer::FrameAvailableListener, Thread { public: Overlay() : Thread(false), Overlay(bool monotonicTimestamps) : Thread(false), mThreadResult(UNKNOWN_ERROR), mState(UNINITIALIZED), mFrameAvailable(false), Loading @@ -45,7 +45,8 @@ public: mStartMonotonicNsecs(0), mStartRealtimeNsecs(0), mLastFrameNumber(-1), mTotalDroppedFrames(0) mTotalDroppedFrames(0), mUseMonotonicTimestamps(monotonicTimestamps) {} // Creates a thread that performs the overlay. Pass in the surface that Loading Loading @@ -151,6 +152,8 @@ private: nsecs_t mLastFrameNumber; size_t mTotalDroppedFrames; bool mUseMonotonicTimestamps; static const char* kPropertyNames[]; }; Loading
cmds/screenrecord/screenrecord.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ static const char* kMimeTypeAvc = "video/avc"; // Command-line parameters. static bool gVerbose = false; // chatty on stdout static bool gRotate = false; // rotate 90 degrees static bool gMonotonicTime = false; // use system monotonic time for timestamps static enum { FORMAT_MP4, FORMAT_H264, FORMAT_FRAMES, FORMAT_RAW_FRAMES } gOutputFormat = FORMAT_MP4; // data format for output Loading Loading @@ -609,7 +610,7 @@ static status_t recordScreen(const char* fileName) { sp<Overlay> overlay; if (gWantFrameTime) { // Send virtual display frames to an external texture. overlay = new Overlay(); overlay = new Overlay(gMonotonicTime); err = overlay->start(encoderInputSurface, &bufferProducer); if (err != NO_ERROR) { if (encoder != NULL) encoder->release(); Loading Loading @@ -892,6 +893,7 @@ int main(int argc, char* const argv[]) { { "show-frame-time", no_argument, NULL, 'f' }, { "rotate", no_argument, NULL, 'r' }, { "output-format", required_argument, NULL, 'o' }, { "monotonic-time", no_argument, NULL, 'm' }, { NULL, 0, NULL, 0 } }; Loading Loading @@ -971,6 +973,9 @@ int main(int argc, char* const argv[]) { return 2; } break; case 'm': gMonotonicTime = true; break; default: if (ic != '?') { fprintf(stderr, "getopt_long returned unexpected value 0x%x\n", ic); Loading