Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b88917cc authored by Vishnu Nair's avatar Vishnu Nair
Browse files

screenrecord: allow recording without a time limit

Screen recording was limited to 3 minutes. The limitation
seems arbitrary so lets remove it.

Test: run `adb shell screenrecord --time-limit 0` and wait for  3 minutes and 1 second
Fixes: 237019907
Change-Id: Ic6710a123ef9fdf99a0f3df308937b8a33b9afcb
parent 256b55c5
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -1026,7 +1026,8 @@ static void usage() {
        "    Add additional information, such as a timestamp overlay, that is helpful\n"
        "    in videos captured to illustrate bugs.\n"
        "--time-limit TIME\n"
        "    Set the maximum recording time, in seconds.  Default / maximum is %d.\n"
        "    Set the maximum recording time, in seconds.  Default is %d. Set to 0\n"
        "    to remove the time limit.\n"
        "--display-id ID\n"
        "    specify the physical display ID to record. Default is the primary display.\n"
        "    see \"dumpsys SurfaceFlinger --display-id\" for valid display IDs.\n"
@@ -1113,14 +1114,27 @@ int main(int argc, char* const argv[]) {
            }
            break;
        case 't':
            gTimeLimitSec = atoi(optarg);
            if (gTimeLimitSec == 0 || gTimeLimitSec > kMaxTimeLimitSec) {
        {
            char *next;
            const int64_t timeLimitSec = strtol(optarg, &next, 10);
            if (next == optarg || (*next != '\0' && *next != ' ')) {
                fprintf(stderr, "Error parsing time limit argument\n");
                return 2;
            }
            if (timeLimitSec > std::numeric_limits<uint32_t>::max() || timeLimitSec < 0) {
                fprintf(stderr,
                        "Time limit %ds outside acceptable range [1,%d]\n",
                        gTimeLimitSec, kMaxTimeLimitSec);
                        "Time limit %" PRIi64 "s outside acceptable range [0,%u] seconds\n",
                        timeLimitSec, std::numeric_limits<uint32_t>::max());
                return 2;
            }
            gTimeLimitSec = (timeLimitSec == 0) ?
                    std::numeric_limits<uint32_t>::max() : timeLimitSec;
            if (gVerbose) {
                printf("Time limit set to %u seconds\n", gTimeLimitSec);
                fflush(stdout);
            }
            break;
        }
        case 'u':
            gWantInfoScreen = true;
            gWantFrameTime = true;