Reoo88 commited on
Commit
0cdc183
·
verified ·
1 Parent(s): 30eda4c

copy H264 even if flap sticky; FLAP_LIMIT=4. Measured: 2x fixed720 = 86-93% cpu-basic quota

Browse files
Files changed (1) hide show
  1. relay.py +10 -2
relay.py CHANGED
@@ -160,8 +160,16 @@ class Sender:
160
  mode=(self.mode_override or os.getenv('YOUTUBE_SEND_MODE','auto')).strip().lower()
161
  if mode not in ('auto','copy','fixed1080','fixed720'):
162
  raise ValueError('وضع الإرسال يجب أن يكون auto أو copy أو fixed1080 أو fixed720')
163
- # A source already proven to flap stays on the constant canvas for this whole event.
164
- if self.sticky_mode:return self.sticky_mode
 
 
 
 
 
 
 
 
165
  # Stream copy is only legal for H.264 in FLV. Before trusting TikTok's own codec label,
166
  # the caller may hand us the candidate it is about to send (see current_candidate).
167
  if mode in ('auto','copy') and self.current_candidate is not None:
 
160
  mode=(self.mode_override or os.getenv('YOUTUBE_SEND_MODE','auto')).strip().lower()
161
  if mode not in ('auto','copy','fixed1080','fixed720'):
162
  raise ValueError('وضع الإرسال يجب أن يكون auto أو copy أو fixed1080 أو fixed720')
163
+ # Sticky transcode is for HEVC / layout flap only. Measured 2026-09-27 on cpu-basic:
164
+ # two fixed720 publishers used 1.67–1.85 of 2.0 quota (peak 92.6%) with YouTube
165
+ # health still good — no headroom for a third. If this candidate is H264, copy.
166
+ if self.sticky_mode:
167
+ cand=self.current_candidate or {}
168
+ blob=(str(cand.get('codec') or '')+' '+str(cand.get('label') or '')+' '+str(cand.get('brief') or '')).lower()
169
+ if any(k in blob for k in ('h264','avc')):
170
+ self.sticky_mode=None
171
+ else:
172
+ return self.sticky_mode
173
  # Stream copy is only legal for H.264 in FLV. Before trusting TikTok's own codec label,
174
  # the caller may hand us the candidate it is about to send (see current_candidate).
175
  if mode in ('auto','copy') and self.current_candidate is not None: