fix(youtube): restore SABR initialization cold start#86
Conversation
|
Thanks. I was able to reproduce the missing init segment issue, but in my local testing, changing the request shape as done here did not appear to fix it. Can you share some logs showing the difference in your test environment? |
|
btw, thanks for your replies and doc updates this week :) I'm busy with some other things this week and your works really helps a lot. (and I am not good at writing docs lol |
|
Hey, I found why our results were different. My first test called The concrete PipePipe caller is the SABR downloader recovery path, not the normal player bootstrap. If This is the minimal sequence I used with the normal test final YoutubeSabrInfo info = YoutubeSabrProbe.fetchSabrInfo(
"X4FeyMPB6SY",
YoutubeSabrClientProfile.WEB,
localization,
country);
final YoutubeSabrFormat audio = info.findFormatByItag(140);
final YoutubeSabrFormat video = info.findFormatByItag(271);
final YoutubeSabrSession session = new YoutubeSabrSession(
info, audio, video, null, null);
session.setTraceEnabled(true);
session.pumpOnce(localization);
session.discardCachedSegment(SabrSegmentRequest.initialization(audio));
session.discardCachedSegment(SabrSegmentRequest.initialization(video));
try {
final SabrMediaSegment init = session.fetchSegment(
SabrSegmentRequest.initialization(video), localization);
System.out.println("video init bytes=" + init.getLength());
} finally {
System.out.println(session.getDiagnosticTrace());
}On base On this PR at Using a fresh session and changing the final request to I applied the same diff temporarily on current main So without this change the downloader recovery asks for init but keeps receiving normal follow-up media, then retries the whole cold start. With this change it receives the init, writes it, and can flush the media that was already waiting. |
|
Yeah of course, np at all! I’ll take care of the small README PR :) And honestly, thx a lot for the recognition and for giving me this opportunity! I really appreciate it, and I’m glad the docs and replies helped :p |
ec9ba0d to
cbd63dd
Compare
|
btw, can you check the webview doc under the latest codebase? It shouldn't require update now but I haven't make tests. |
|
Yep, I checked it on the latest codebase :) I used fresh PipePipeClient and PipePipeExtractor clones, then tested the I updated the documentation to explain that 5.2.4-beta no longer requires And like we said before, if u ever need me for the documentation, the extractor, It genuinely makes me very happy to contribute to PipePipe, it is honestly my |
Summary
While fixing a SABR playback regression in TypeType, I found that initialization requests could receive several valid SABR responses without the requested init segment.
The session eventually failed with:
PipePipe normally gets initialization data directly from the format metadata, but both the player fallback and the downloader still use
fetchSegment(SabrSegmentRequest.initialization(...))when that data is unavailable.This restores the cold-start request shape needed for those initialization requests without changing the normal media request flow.
Problem
An initialization request needs to identify the requested audio or video track without carrying the buffered ranges and playback state of a normal follow-up request.
With the current request shape, YouTube can return policy and media responses while skipping the requested init segment entirely.
Changes
Validation
Build:
./gradlew :extractor:compileJavagit diff --checkRuntime validation through TypeType with the patched extractor:
Test videos:
https://www.youtube.com/watch?v=X4FeyMPB6SYhttps://www.youtube.com/watch?v=J_T7EFHEcpcNotes
This is extractor-only. PipePipe already uses the affected initialization API, so no client change is required.
This does not address WebView, BotGuard, or DNS failures. It only fixes SABR init-segment retrieval.