On: same copy engine as Prayer-Time-Bot.
Browse filesRestore v2.12 relay (copy H264; stall 12). Keep tick unlocked.
matchgop only after out>=20 like Prayer. Not default 720.
- relay.py +23 -36
- youtube_manager.py +1 -6
relay.py
CHANGED
|
@@ -565,9 +565,7 @@ class Sender:
|
|
| 565 |
except queue.Empty:
|
| 566 |
silent = time.monotonic() - sess['last']
|
| 567 |
if self._stall_seconds() and silent > self._stall_seconds():
|
| 568 |
-
|
| 569 |
-
# (YouTube holds the last frame, then a new ingest). Watchdog splices.
|
| 570 |
-
sess['source_gap'] = True
|
| 571 |
return
|
| 572 |
continue
|
| 573 |
pending = None
|
|
@@ -588,8 +586,6 @@ class Sender:
|
|
| 588 |
sess['timeouts'] = 0
|
| 589 |
if not chunk:
|
| 590 |
continue
|
| 591 |
-
sess['source_gap'] = False
|
| 592 |
-
sess['reattach_fails'] = 0
|
| 593 |
sess['last'] = time.monotonic()
|
| 594 |
with self.lock:
|
| 595 |
self.data['source_bytes'] += len(chunk)
|
|
@@ -628,6 +624,8 @@ class Sender:
|
|
| 628 |
"""
|
| 629 |
if not refresh or p is None or p.stdin is None or p.poll() is not None:
|
| 630 |
return None
|
|
|
|
|
|
|
| 631 |
sess['swapping'] = True
|
| 632 |
sess['swap_source'] = True
|
| 633 |
sess['swap_started'] = time.monotonic()
|
|
@@ -887,29 +885,22 @@ class Sender:
|
|
| 887 |
self.sticky_mode=None
|
| 888 |
self.sticky_since=0.0
|
| 889 |
self._recovering_copy=False
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
|
| 903 |
-
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
sess['error'] = ''
|
| 907 |
-
sess['reattach_fails'] = 0
|
| 908 |
-
continue
|
| 909 |
-
sess['reattach_fails'] = int(sess.get('reattach_fails') or 0) + 1
|
| 910 |
-
if now - float(sess.get('hold_log_at') or 0) > 60:
|
| 911 |
-
self.log(user, '[RELAY] ุชูู ุชูู ุตุงู
ุช ู
ูุฐ %.0f ุซุ ููุจูู ูุณุฎ FFmpeg ุนูู ููุชููุจ ุจูุง ูุชู'% (now - _fresh))
|
| 912 |
-
sess['hold_log_at'] = now
|
| 913 |
rc = p.poll()
|
| 914 |
if rc is not None:
|
| 915 |
if sess['format_changed']:
|
|
@@ -926,17 +917,13 @@ class Sender:
|
|
| 926 |
self.log(user, 'FFmpeg ุฎุฑุฌ ุจุฑู
ุฒ %s%s%s%s' % (
|
| 927 |
rc, ' โ ' + 'ุ '.join(diagnostics[-3:]) if diagnostics else 'ุ ูู
ูุธูุฑ ุณุจุจ ู
ุตููู', blame, tail))
|
| 928 |
break
|
| 929 |
-
if now - progress['last'] > progress_limit
|
| 930 |
raise SourceStalled('ูู
ูุชูุฏูู
FFmpeg ู
ูุฐ %.0f ุซ' % (now - progress['last']))
|
| 931 |
if sess['ended'] and not sess['error']:
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
sess['source_gap'] = True
|
| 935 |
if sess['error']:
|
| 936 |
-
|
| 937 |
-
self.log(user, '[RELAY] ู
ุตุฏุฑ ุชูู ุชูู: %s โ ููุจูู ุฌูุณุฉ ููุชููุจ' % str(sess['error'])[:120])
|
| 938 |
-
sess['error'] = ''
|
| 939 |
-
sess['source_gap'] = True
|
| 940 |
if response is not None and now >= next_report:
|
| 941 |
# ุจู
ุนุฏู ู
ุถุจูุท: ูุง logging ููู ุจุงูุช (ูุงู ุณูู
ูุฃ ุงูุณุฌู ูู ุฏูุงุฆู).
|
| 942 |
next_report = now + max(15, int(os.getenv('YOUTUBE_WATCHDOG_REPORT_SECONDS', '60')))
|
|
|
|
| 565 |
except queue.Empty:
|
| 566 |
silent = time.monotonic() - sess['last']
|
| 567 |
if self._stall_seconds() and silent > self._stall_seconds():
|
| 568 |
+
sess['error'] = 'ุตู
ุช ู
ู ุชูู ุชูู (%.0f ุซ ุจูุง ุจุงูุช)' % silent
|
|
|
|
|
|
|
| 569 |
return
|
| 570 |
continue
|
| 571 |
pending = None
|
|
|
|
| 586 |
sess['timeouts'] = 0
|
| 587 |
if not chunk:
|
| 588 |
continue
|
|
|
|
|
|
|
| 589 |
sess['last'] = time.monotonic()
|
| 590 |
with self.lock:
|
| 591 |
self.data['source_bytes'] += len(chunk)
|
|
|
|
| 624 |
"""
|
| 625 |
if not refresh or p is None or p.stdin is None or p.poll() is not None:
|
| 626 |
return None
|
| 627 |
+
if int(sess.get('reattaches') or 0) >= 8:
|
| 628 |
+
return None
|
| 629 |
sess['swapping'] = True
|
| 630 |
sess['swap_source'] = True
|
| 631 |
sess['swap_started'] = time.monotonic()
|
|
|
|
| 885 |
self.sticky_mode=None
|
| 886 |
self.sticky_since=0.0
|
| 887 |
self._recovering_copy=False
|
| 888 |
+
if stall_limit and now - _fresh > stall_limit and (not sess.get('swapping') or swap_for > stall_limit):
|
| 889 |
+
attached = self._try_reattach(user, p, bridge, sess, stop, refresh,
|
| 890 |
+
read_timeout, retries, response, pump)
|
| 891 |
+
if attached:
|
| 892 |
+
response, pump = attached
|
| 893 |
+
continue
|
| 894 |
+
# ููููู ุงูุฎูุท ุฃูููุง (ูุฏ ูููู ู
ุญุจูุณูุง ูู write ุนูู ุฃูุจูุจ ู
ู
ุชูุฆ)ุ ุซู
ูุฑูุน:
|
| 895 |
+
# ุฅุบูุงู stdin ูุฌุนู FFmpeg ูุฑู EOF ููุชููู ุจูุทู ุจุฏู SIGKILL.
|
| 896 |
+
sess['force_stop'] = True
|
| 897 |
+
if p.stdin:
|
| 898 |
+
try:
|
| 899 |
+
p.stdin.close()
|
| 900 |
+
except (OSError, ValueError):
|
| 901 |
+
pass
|
| 902 |
+
raise SourceStalled('ุงููุทุน ุชุฏูู ุงูู
ุตุฏุฑ ู
ูุฐ %.0f ุซ (FFmpeg ู
ุง ุฒุงู ุญููุงุ '
|
| 903 |
+
'ูููุชููุจ ูุจูู ุนูู ุขุฎุฑ ุซุงููุฉ ูุตูุชู)' % (now - _fresh))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 904 |
rc = p.poll()
|
| 905 |
if rc is not None:
|
| 906 |
if sess['format_changed']:
|
|
|
|
| 917 |
self.log(user, 'FFmpeg ุฎุฑุฌ ุจุฑู
ุฒ %s%s%s%s' % (
|
| 918 |
rc, ' โ ' + 'ุ '.join(diagnostics[-3:]) if diagnostics else 'ุ ูู
ูุธูุฑ ุณุจุจ ู
ุตููู', blame, tail))
|
| 919 |
break
|
| 920 |
+
if now - progress['last'] > progress_limit:
|
| 921 |
raise SourceStalled('ูู
ูุชูุฏูู
FFmpeg ู
ูุฐ %.0f ุซ' % (now - progress['last']))
|
| 922 |
if sess['ended'] and not sess['error']:
|
| 923 |
+
self.log(user, '[MONITOR] ุฃุบูู ุชูู ุชูู ุงูุงุณุชุฌุงุจุฉุ ุงูุฌูุณุฉ ุชูุนุงุฏ ู
ู ุฌุฏูุฏ')
|
| 924 |
+
break
|
|
|
|
| 925 |
if sess['error']:
|
| 926 |
+
raise SourceStalled(sess['error'])
|
|
|
|
|
|
|
|
|
|
| 927 |
if response is not None and now >= next_report:
|
| 928 |
# ุจู
ุนุฏู ู
ุถุจูุท: ูุง logging ููู ุจุงูุช (ูุงู ุณูู
ูุฃ ุงูุณุฌู ูู ุฏูุงุฆู).
|
| 929 |
next_report = now + max(15, int(os.getenv('YOUTUBE_WATCHDOG_REPORT_SECONDS', '60')))
|
youtube_manager.py
CHANGED
|
@@ -1664,7 +1664,6 @@ class ManagedYouTube:
|
|
| 1664 |
issues.append('%s [%s] %s'%(i.get('type',''),sev,i.get('reason','')))
|
| 1665 |
text=' | '.join(issues)
|
| 1666 |
prev=ev.get('last_issues')
|
| 1667 |
-
prev_health=str(ev.get('youtube_health') or '')
|
| 1668 |
status=str(health.get('status') or '')
|
| 1669 |
self.event_update(key,youtube_health=status,youtube_issues=text,last_issues=text)
|
| 1670 |
if text and text!=prev:
|
|
@@ -1680,11 +1679,7 @@ class ManagedYouTube:
|
|
| 1680 |
snap=sender.snapshot() or {}
|
| 1681 |
out=float(snap.get('output_seconds') or 0)
|
| 1682 |
mode=(snap.get('send_mode') or sender.send_mode() or '')
|
| 1683 |
-
|
| 1684 |
-
# out>=20 skips the first noData of a fresh ingest. It also blocked the
|
| 1685 |
-
# measured failure: copy stall-restarts with out=0 after YouTube had been good.
|
| 1686 |
-
ready=out>=20 or (nodata and prev_health.lower()=='good')
|
| 1687 |
-
if copy_like and ready:
|
| 1688 |
sender.request_sticky('matchgop', user, 'YouTube %s (out=%.0fs copy not ingesting for viewers)'%(status or text[:40], out))
|
| 1689 |
def run_manager(self):
|
| 1690 |
checked=False
|
|
|
|
| 1664 |
issues.append('%s [%s] %s'%(i.get('type',''),sev,i.get('reason','')))
|
| 1665 |
text=' | '.join(issues)
|
| 1666 |
prev=ev.get('last_issues')
|
|
|
|
| 1667 |
status=str(health.get('status') or '')
|
| 1668 |
self.event_update(key,youtube_health=status,youtube_issues=text,last_issues=text)
|
| 1669 |
if text and text!=prev:
|
|
|
|
| 1679 |
snap=sender.snapshot() or {}
|
| 1680 |
out=float(snap.get('output_seconds') or 0)
|
| 1681 |
mode=(snap.get('send_mode') or sender.send_mode() or '')
|
| 1682 |
+
if out>=20 and mode in ('','auto','copy') and not sender.sticky_mode:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1683 |
sender.request_sticky('matchgop', user, 'YouTube %s (out=%.0fs copy not ingesting for viewers)'%(status or text[:40], out))
|
| 1684 |
def run_manager(self):
|
| 1685 |
checked=False
|