summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-02-05setbrwindow: wait for window instead of exitingVito Caputo
When --windowid specifies a window that hasn't yet been mapped this thing would just exit. But in scripted invocations where a window of interest is created and mapped by the client immediately prior to launching recordMyDesktop, there's a good chance the window manager hasn't yet handled the MapRequest before recordMyDesktop launched and attempted to get the window's attributes. This change subscribes to the window's visibility and structure events when the attributes show it's not yet mapped and visible, entering into an event loop waiting for the window. No timeout has been added at this time. Some interesting directions to go from here: - Pause recording on unmap, resume recording on map - Follow the window if it moves - It'd be nice if recording could handle window resizes, but especially for on-the-fly encoding this seems awkward at best. For cached recordings the encode could start with the largest dimensions and simply pad out any smaller frames. I'll have to look at Theora to see if there is any support for variable sized video streams. Fixes https://github.com/recordmydesktop/recordmydesktop/issues/7
2022-02-01setbrwindow: trivial formatting fixupsVito Caputo
Fix some minor whitespace/indentation inconsistency.
2022-01-09parseargs: fixup --help typos and inconsistenciesVito Caputo
Trivial cosmetic changes noticed while glancing at --help
2021-08-19get_frames: nix even coord constraint in rmdMoveCaptureAreaVito Caputo
We no longer bother with such things in this fork. It's worth noting the original codebase bothered with these things in places where it was altogether unnecessary. This means --follow-mouse will precisely follow the mouse, not only when the mouse has moved out of the bounding area enough to reach the next even coordinate.
2021-08-19get_frames: fix --follow-mouseVito Caputo
Put back parens which must have been removed accidentally in a cosmetic cleanup pass, restores --follow-mouse functionality which was confirmed/reported as broken by @koo5 in https://github.com/Enselic/recordmydesktop/pull/32#issuecomment-902089762
2021-06-12Use memcpy to copy FRAM, not strncpyMartin Nordholts
Fixes: warning: ‘__builtin_strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
2021-06-12Cast AllPlanes to CARD32 for planeMaskMartin Nordholts
Fixes: warning: conversion from ‘long unsigned int’ to ‘CARD32’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Woverflow]
2021-06-12Fix jack_client_new() deprecation warningMartin Nordholts
By inlining its current implementation in libjack: https://github.com/jackaudio/jack1/blob/2e78fb6c883286287ae514ff0d262a5584ecdd35/libjack/client.c#L1429 The end-result should be that that the behavior of the app remains the same as before.
2021-04-30*: minor message string typo fixupsVito Caputo
nothing functionally different
2021-04-29yuv_utils: more cleanupsVito Caputo
other than a div to shift coversion, this is just formatting cleanups
2021-04-28yuv_utils: fix rmdXFixesPointerToYuv() UV bugVito Caputo
fixes bug introduced by typo in 5322492387de bug manifested as pointer region's colors being off
2021-04-28encode_cache: handle pthread_create() errorsVito Caputo
switch to using rmdThread() and handle errors previously pthread_create() errors were completely unnoticed
2021-04-28threads: handle pthread_create() errorsVito Caputo
This doesn't try to cleanup anything on the failures, basically assuming they're always fatal and the process will exit. Previously no pthread_create() errors were noticed at all, which could result in some very strange failure modes.
2021-04-28specsfile: firm up error checkingVito Caputo
specsfile write failures were completely undetected outside of fopen errors
2021-04-28specsfile: formatting cleanupVito Caputo
no functional changes
2021-04-27cache_audio: narrow scope of SndBuffer *buffVito Caputo
also stop unnecessary NULL initialization
2021-04-08test-rectinsert: fixup to no longer expect aligningVito Caputo
Alignment is done separately to the inserted rect in uv_align() now, the dirty rect structure no longer concerns itself with such things. After this commit `make check` passes again... not that there's much coverage to speak of.
2021-04-05encode_audio_buffers: remove some pointless duplicationVito Caputo
rmdEncodeAudioBuffers() and rmdSyncEncodeAudioBuffer() each implemented the actual jack vs. non-jack encoding of the buffer redundantly despite being identical. This commit moves that step into a shared private function.
2021-04-04*: s/rmdEncodeImageBuffer/rmdEncodeImageBuffers/Vito Caputo
finishing up mechanical change started in previous commit
2021-04-04*: encode_image_buffer.[ch]->encode_audio_buffers.[ch]Vito Caputo
mechanical change to get filenames more accurate, thread function will be renamed in subsequent commit.
2021-04-04*: s/rmdEncodeAudioBuffer/rmdEncodeAudioBuffers/Vito Caputo
finishing up mechanical change started in previous commit
2021-04-04*: encode_audio_buffer.[ch]->encode_audio_buffers.[ch]Vito Caputo
mechanical change to get filenames more accurate, thread function will be renamed in subsequent commit.
2021-04-04*: trivial cleanupsVito Caputo
s/for(/for (/g
2021-03-15*: random whitespace cleanupsVito Caputo
Mostly trailing space/tab removals, no functional changes.
2021-03-13get_frames: remove superfluous avd assignmentVito Caputo
Since avd is unconditionally copied just a few lines down, this copy is pointless and harms readability. I think when it was originally written there was going to be an else branch where the unconditional copy is currently, but never bothered. The avd shared variable should really get changed to an atomic, removing its lock. To anyone reading: PRs welcome.
2021-02-12cache: _rmdCacheFileClose should always NULL handlesVito Caputo
The existing code would leave the internal handle non-NULL when the underlying close failed. In the event of a transparent close when chapters switch failing, a subsequent explicit close is expected, and the handles must be NULLed out for that explicit close to not blow up because fclose() leaves the handle undefined after errors. It's basically a use after free bug.
2021-01-06rescue: zero initialize structsVito Caputo
Various functions rely on this stuff at least being zeroed, rmd.c already had been fixed but rmd_rescue.c has been neglected.
2021-01-06poll_events: fix clip bounds check in uv_alignVito Caputo
This would potentially exceed the clip w/h on odd inputs because it was wrongly adding the cliprect offset while comparing against coordinates already made relative within the cliprect
2021-01-06load_cache: fix divzero bug introduced by 5ce6553Vito Caputo
--rescue mode doesn't set pdata->capture_frameno to the total The whole --rescue initialization path is a snowflake and should get reworked to share more in common with the normal startup. reported by @xloem, thanks!
2020-11-14poll_events: actually store the result of uv_align()Vito Caputo
Spurious artifacts in the chroma channels when the damage regions weren't aligned showed up because this function wasn't actually doing anything.
2020-11-13opendev: bump granularity of audio capture periodsVito Caputo
This only applies to ALSA, but the av-sync precision is entirely dependent on the granularity of what ALSA refers to as "periods". The pdata->avd delay is decremented by the audio capture in period aligned steps, meaning the smallest decrement it can possibly do is the period size. Between these period sized intervals, rmdGetFrames kind of flies blind if the FPS is high enough for frametime to be substantially smaller than the period time. A smaller period does increase the ALSA capture overhead, basically increasing the number of times ALSA returns data to userspace, kind of like a higher interrupt rate. But it seems negligible for a modern system.
2020-11-13*: rename rmd_get_frame.[ch] to rmd_get_frames.[ch]Vito Caputo
mechanical file rename to plural form
2020-11-13get_frame: s/rmdGetFrame/rmdGetFrames/Vito Caputo
Mechanical rename to more accurate plural form
2020-11-12register_callbacks: permit paused quit and abortVito Caputo
Not sure why the inherited code prohibited this, but it doesn't jive with my expectations to ignore SIGINT just because the recording is paused.
2020-11-12timer: remove unnecessary timer threadVito Caputo
This removes the timer thread entirely in favor of a coordinated delay loop directly within rmdGetFrame. When there's an audio stream to synchronize with, avd is maintained by the pcm buffer updates, and the fps-derived frametimes synchronize with the audio that way. When there's no audio stream (--no-sound), avd is now maintained synthetically via clock_gettime(CLOCK_MONOTONIC) coordinating with the clock instead. There's been some reworking of frame sampling/reusing and cloning logic, which may need some refinement. But for now the tests seem to show promise. The old timer approach just increased the non-determinism by adding more scheduler latency and influence unnecessarily.
2020-11-11macro: enclose MIN/MAX macros in parensVito Caputo
2020-11-11*: add _us suffixes to {frame,period}time namesVito Caputo
Make the names reflect their units of microseconds
2020-11-09cache: overload syncer thread to also pre-allocateVito Caputo
This changes the syncer thread to always be created for writers, and makes it posix_fallocate() the cache file to the maximum size. When the syncer is disabled w/ms=0, it simply returns after the posix_fallocate. posix_fallocate errors are ignored, this is simply an opportunistic optimization. I have some concern about the glibc emulation mentioned in the man page, but writers are opened O_WRONLY which the notes say cause the emulation to fail with EBADF which is preferable, and I'm using O_WRONLY for the writers.
2020-11-09load_cache: treat invalid frame header as EOFVito Caputo
In preparation for posix_fallocate() pre-allocation of cache files, expect zeroes for the header when running off the end of valid data into the only allocated space, and handle gracefully as an EOF equivalent.
2020-11-09cache: introduce "syncer" thread for cache writersVito Caputo
This adds a new flag: --periodic-datasync-ms with a default of 100ms. When a new CacheFile is created for writing, and the datasync period is non-zero, a thread is created for the sole purpose of calling fdatasync() on the underlying fd in a loop separated by sleeps of the specified duration. The purpose of this is to prevent a large backlog of dirty buffers from accumulating until the operating system's normal background dirty sync kicks in. Depending on how the underlying filesystem and storage stack is configured, these bulk writebacks can result in very long stalls on a subsequent write operation. This is easily observed on ext4+lvm+dmcrypt setups, even using a simple test like `dd if=/dev/urandom of=testfile bs=8M`. Despite having plenty of available buffers, once ext4's internal journal fills while a bulk writeback is underway, dd's progress will completely stall until the entire writeback is completed, usually it's in the jbd2 wchan of do_get_write_access(). When this occurs during a recording by recordMyDesktop, the result is dropping frames for the entire duration of the stall. One thing recordMyDesktop could do to insulate from this is perform its own buffering of sampled frames at the YUV stage, with the cache writer consuming from this pool of buffered frames. Then when the cache writer gets stalled on jbd2/dmcrypt holdups, the buffer pool just grows instead of frames being dropped. I may explore this option in the future, but for now simply syncing regularly has been sufficient in my usage, as it keeps the storage subsystem more continuously utilized and spreads out the writebacks so they don't completely back up the journal.
2020-11-08yuv_utils: fixup yuv chroma offset/stride mathVito Caputo
hopefully this is is all of it, will need more testing I noticed during some non-full-shots tests that the dirty areas didn't seem to be getting rounded up properly so my single pixel window border's color was sometimes omitted on the right edge and bottom...
2020-11-08capture_audio: trivial whitespace fixupVito Caputo
2020-11-08cache: pivot to new CacheFile APIVito Caputo
This minimally switches all the ad-hoc image cache files handling over to using CacheFile. I left the audio cache alone for now as it seems to not be compressed. It might make sense in the future to switch that over as well, especially if I start adding features to CacheFile like preallocating and async periodic fdatasync.
2020-11-08cache: introduce rudimentary CacheFile APIVito Caputo
Throughout the existing cache-related code there's constant checking if compression is active or not. This commit introduces a CacheFile ADT with the intention of replacing all the open coded stuff with simple calls into rmdCacheFile* functions operating on CacheFile instances. The management of split up cache files has also been implemented behind this API, so the reads and writes will transparently handle the split files. These have been named "chapters" in new code. No callers have been changed, this only adds the new facility. A subsequent commit will migrate things over.
2020-10-30*: more minor cleanupsVito Caputo
No need for fflush(stderr) when it's already unbuffered by default. According to setvbuf(3): Normally all files are block buffered. If a stream refers to a terminal (as stdout normally does), it is line buffered. The standard error stream stderr is always unbuffered by default.
2020-10-08*: more cosmetic formatting cleanupsVito Caputo
Making things a bit more consistent
2020-09-08cache_audio: s/sound/audio/ where appropriateVito Caputo
Despite this listing already being named rmd_cache_audio, it used sound instead of audio for the api.
2020-09-08encode_audio_buffer: s/sound/audio/ where appropriateVito Caputo
Largely mechanical cosmetic changes for more consistency
2020-09-08encode_sound_buffer: rename to encode_audio_bufferVito Caputo
Cosmetic rename to make naming consistent, normalizing on audio. This is a minimal rename and includes update, subsequent commit will change naming as appropriate in rmd_encode_audio_buffer.[ch]
2020-09-08capture_audio: s/sound/audio/ where reasonableVito Caputo
Largely mechanical change just finishing up cosmetic rename of rmd_capture_sound->rmd_capture_audio
© All Rights Reserved