Claude/gnome wallpaper auto rotation r1ailq #1

Merged
Quinta0 merged 12 commits from claude/gnome-wallpaper-auto-rotation-r1ailq into main 2026-08-04 20:53:28 +02:00
Showing only changes of commit 14078f0466 - Show all commits
+20 -8
View File
@@ -50,6 +50,7 @@ export class LiveWallpaperManager {
this._upowerSignalId = 0; this._upowerSignalId = 0;
this._frameCount = 0; this._frameCount = 0;
this._newSampleCallCount = 0;
this._noFrameWatchdogId = 0; this._noFrameWatchdogId = 0;
} }
@@ -162,13 +163,16 @@ export class LiveWallpaperManager {
this._logger.debug(`playbin.set_state(PLAYING) returned ${stateChangeResult}`); this._logger.debug(`playbin.set_state(PLAYING) returned ${stateChangeResult}`);
this._frameCount = 0; this._frameCount = 0;
this._newSampleCallCount = 0;
this._noFrameWatchdogId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 4, () => { this._noFrameWatchdogId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 4, () => {
this._noFrameWatchdogId = 0; this._noFrameWatchdogId = 0;
if (this._active && this._frameCount === 0) { if (this._active && this._frameCount === 0) {
this._logger.warn( this._logger.warn(
'Live wallpaper: no frames received 4s after starting playback. ' + `Live wallpaper: no frames received 4s after starting playback ` +
'The pipeline likely stalled during caps negotiation or preroll without ' + `(new-sample signal fired ${this._newSampleCallCount} times). ` +
'raising an error — check for GStreamer WARNING messages logged above.'); 'If that count is 0, the signal itself never fired (check for a stalled ' +
'pipeline above); if it is nonzero, pull_sample()/buffer processing is failing ' +
'— check for a "Failed to process live wallpaper frame" error above.');
} }
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
@@ -185,19 +189,27 @@ export class LiveWallpaperManager {
_onNewSample(sink) { _onNewSample(sink) {
const Gst = this._Gst; const Gst = this._Gst;
const sample = sink.pull_sample(); this._newSampleCallCount = (this._newSampleCallCount ?? 0) + 1;
if (!sample) if (this._newSampleCallCount === 1)
return Gst.FlowReturn.OK; this._logger.debug('Live wallpaper: new-sample signal fired for the first time');
try { try {
const sample = sink.pull_sample();
if (!sample) {
this._logger.debug('Live wallpaper: pull_sample() returned no sample');
return Gst.FlowReturn.OK;
}
const buffer = sample.get_buffer(); const buffer = sample.get_buffer();
const structure = sample.get_caps().get_structure(0); const structure = sample.get_caps().get_structure(0);
const [, width] = structure.get_int('width'); const [, width] = structure.get_int('width');
const [, height] = structure.get_int('height'); const [, height] = structure.get_int('height');
const [ok, mapInfo] = buffer.map(Gst.MapFlags.READ); const [ok, mapInfo] = buffer.map(Gst.MapFlags.READ);
if (!ok) if (!ok) {
this._logger.debug('Live wallpaper: buffer.map() failed');
return Gst.FlowReturn.OK; return Gst.FlowReturn.OK;
}
try { try {
this._updateFrame(mapInfo.data, width, height); this._updateFrame(mapInfo.data, width, height);
@@ -210,7 +222,7 @@ export class LiveWallpaperManager {
buffer.unmap(mapInfo); buffer.unmap(mapInfo);
} }
} catch (e) { } catch (e) {
this._logger.error(e, 'Failed to process live wallpaper frame'); this._logger.error(e, 'Failed to process live wallpaper frame (new-sample handler)');
} }
return Gst.FlowReturn.OK; return Gst.FlowReturn.OK;