Merge branch 'worktree-agent-a20a8a7bdf596fb77'
Browse files at this commit3 changed files +45 -6
- crates/app/src/export_ui.rs +15 -0
- crates/app/src/player/export.rs +1 -6
- crates/app/src/tests/cards.rs +29 -0
crates/app/src/export_ui.rsmodified+15 -0
| @@ -663,6 +663,21 @@ pub(crate) fn export_settings( | ||
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | +/// The same settings with the budget taken out -- what the seat probe is asked | |
| 667 | +/// and keyed on ([`crate::Player::cache_export_seat`]). A bitrate does not | |
| 668 | +/// decide whether this machine has a VA-API seat or whether the picture's | |
| 669 | +/// packets can be copied; leaving it in the key meant every wheel notch on the | |
| 670 | +/// budget row invalidated the answer and opened a real VA-API encoder to ask it | |
| 671 | +/// again -- measured at ten opens for ten notches, 5-32 ms of GPU work each, | |
| 672 | +/// against the player's own decoder, which is the "freezes a little" this row | |
| 673 | +/// was reported for. | |
| 674 | +pub(crate) fn probe_settings(format: Format, audio_kbps: u32, seat: EncoderSeat) -> ExportSettings { | |
| 675 | + ExportSettings { | |
| 676 | + bitrate: None, | |
| 677 | + ..export_settings(0, format, audio_kbps, seat) | |
| 678 | + } | |
| 679 | +} | |
| 680 | + | |
| 666 | 681 | /// The budget's bounds, the engine's own (`engine::export`'s `MIN_BITRATE` |
| 667 | 682 | /// and `MAX_EXPLICIT_BITRATE`): a number outside them would be written as a |
| 668 | 683 | /// different one, so the lever and the field clamp to exactly these. |
crates/app/src/player/export.rsmodified+1 -6
| @@ -351,12 +351,7 @@ impl Player { | ||
| 351 | 351 | let Some(session) = &self.session else { |
| 352 | 352 | return; |
| 353 | 353 | }; |
| 354 | - let settings = export_settings( | |
| 355 | - self.budget_bps(), | |
| 356 | - self.format, | |
| 357 | - self.audio_kbps, | |
| 358 | - self.encoder_seat(), | |
| 359 | - ); | |
| 354 | + let settings = probe_settings(self.format, self.audio_kbps, self.encoder_seat()); | |
| 360 | 355 | if !self.export_open { |
| 361 | 356 | return; |
| 362 | 357 | } |
crates/app/src/tests/cards.rsmodified+29 -0
| @@ -2066,3 +2066,32 @@ fn toggle_proxy_wakes_the_asked_phase_it_stops() { | ||
| 2066 | 2066 | "a stop asked during Asked no longer sets the flag the header read polls" |
| 2067 | 2067 | ); |
| 2068 | 2068 | } |
| 2069 | + | |
| 2070 | +/// A wheel notch on the budget must not re-ask the seat probe. The probe opens | |
| 2071 | +/// a real VA-API encoder (ten opens for ten notches before this, 5-32 ms of GPU | |
| 2072 | +/// work each, against the player's own decoder) and its answer -- GPU seat or | |
| 2073 | +/// software, copy or encode -- does not depend on the bitrate at all. So the | |
| 2074 | +/// settings it is keyed on carry no budget, and the budget still reaches the | |
| 2075 | +/// export itself, which is the one place it changes a file. | |
| 2076 | +#[test] | |
| 2077 | +fn the_seat_probe_is_not_keyed_on_the_budget() { | |
| 2078 | + let seat = EncoderSeat::default(); | |
| 2079 | + let asked = crate::probe_settings(Format::Mp4, DEFAULT_AUDIO_KBPS, seat); | |
| 2080 | + assert_eq!(asked.bitrate, None, "no budget is in the probe's question"); | |
| 2081 | + // What still *is* a new question: the format the file is written in. | |
| 2082 | + assert_ne!( | |
| 2083 | + asked, | |
| 2084 | + crate::probe_settings(Format::Av1, DEFAULT_AUDIO_KBPS, seat), | |
| 2085 | + "a format change must re-probe" | |
| 2086 | + ); | |
| 2087 | + let cache = fn_body("cache_export_seat"); | |
| 2088 | + assert!( | |
| 2089 | + cache.contains("probe_settings(") && !cache.contains("budget_bps()"), | |
| 2090 | + "the seat cache is keyed on the budget again" | |
| 2091 | + ); | |
| 2092 | + // ...and the number the wheel moves is still what the export is given. | |
| 2093 | + assert!( | |
| 2094 | + fn_body("start_export").contains("self.budget_bps()"), | |
| 2095 | + "the export no longer writes at the budget on the row" | |
| 2096 | + ); | |
| 2097 | +} |