|
23 | 23 | import com.google.android.exoplayer2.source.sabr.parser.parts.PoTokenStatusSabrPart.PoTokenStatus; |
24 | 24 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.BufferedRange; |
25 | 25 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.ClientAbrState; |
26 | | -import com.google.android.exoplayer2.source.sabr.protos.videostreaming.ClientInfo; |
| 26 | +import com.google.android.exoplayer2.source.sabr.protos.videostreaming.StreamerContext.ClientInfo; |
27 | 27 | import com.google.android.exoplayer2.source.sabr.protos.misc.FormatId; |
28 | 28 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.FormatInitializationMetadata; |
29 | 29 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.LiveMetadata; |
30 | 30 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.MediaHeader; |
31 | 31 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.NextRequestPolicy; |
32 | | -import com.google.android.exoplayer2.source.sabr.protos.videostreaming.SabrContext; |
| 32 | +import com.google.android.exoplayer2.source.sabr.protos.videostreaming.StreamerContext.ClientName; |
| 33 | +import com.google.android.exoplayer2.source.sabr.protos.videostreaming.StreamerContext.SabrContext; |
33 | 34 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.SabrContextSendingPolicy; |
34 | 35 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.SabrContextUpdate; |
35 | 36 | import com.google.android.exoplayer2.source.sabr.protos.videostreaming.SabrSeek; |
@@ -685,20 +686,100 @@ public int getLiveSegmentTargetDurationSec() { |
685 | 686 | return liveSegmentTargetDurationSec; |
686 | 687 | } |
687 | 688 |
|
| 689 | + //public VideoPlaybackAbrRequest buildVideoPlaybackAbrRequest() { |
| 690 | + // return VideoPlaybackAbrRequest.newBuilder() |
| 691 | + // .setClientAbrState(getClientAbrState()) |
| 692 | + // .addAllPreferredVideoFormatIds(selectedVideoFormatIds) |
| 693 | + // .addAllPreferredAudioFormatIds(selectedAudioFormatIds) |
| 694 | + // .addAllPreferredSubtitleFormatIds(selectedCaptionFormatIds) |
| 695 | + // .addAllSelectedFormatIds(getSelectedFormatIds()) |
| 696 | + // .setVideoPlaybackUstreamerConfig( |
| 697 | + // ByteString.copyFrom( |
| 698 | + // Base64.decode(videoPlaybackUstreamerConfig, Base64.URL_SAFE) |
| 699 | + // ) |
| 700 | + // ) |
| 701 | + // .setStreamerContext(createStreamerContext()) |
| 702 | + // .addAllBufferedRanges(createBufferedRanges()) |
| 703 | + // .build(); |
| 704 | + //} |
| 705 | + |
688 | 706 | public VideoPlaybackAbrRequest buildVideoPlaybackAbrRequest() { |
| 707 | + ClientAbrState clientAbrStateTest = ClientAbrState.newBuilder() |
| 708 | + .setLastManualSelectedResolution(1080) |
| 709 | + .setStickyResolution(1080) |
| 710 | + .setBandwidthEstimate(1350000) |
| 711 | + .setEnabledTrackTypesBitfield(2) |
| 712 | + .setDrcEnabled(false) |
| 713 | + .setSabrForceMaxNetworkInterruptionDurationMs(0) |
| 714 | + .build(); |
| 715 | + |
| 716 | + FormatId selectedVideo = FormatId.newBuilder() |
| 717 | + .setItag(399) |
| 718 | + .setLastModified(1759475866788004L) |
| 719 | + .build(); |
| 720 | + FormatId selectedAudio = FormatId.newBuilder() |
| 721 | + .setItag(140) |
| 722 | + .setLastModified(1759475037898391L) |
| 723 | + .build(); |
| 724 | + List<FormatId> selectedFormats = new ArrayList<>(); |
| 725 | + selectedFormats.add(selectedAudio); |
| 726 | + |
| 727 | + List<FormatId> preferredVideoFormats = new ArrayList<>(); |
| 728 | + preferredVideoFormats.add(selectedVideo); |
| 729 | + |
| 730 | + List<FormatId> preferredAudioFormats = new ArrayList<>(); |
| 731 | + preferredAudioFormats.add(selectedAudio); |
| 732 | + |
| 733 | + TimeRange timeRange = TimeRange.newBuilder() |
| 734 | + .setStartTicks(0) |
| 735 | + .setDurationTicks(2147483647) |
| 736 | + .setTimescale(1000) |
| 737 | + .build(); |
| 738 | + BufferedRange bufferedRange = BufferedRange.newBuilder() |
| 739 | + .setFormatId(selectedAudio) |
| 740 | + .setStartTimeMs(0) |
| 741 | + .setDurationMs(2147483647) |
| 742 | + .setStartSegmentIndex(2147483647) |
| 743 | + .setEndSegmentIndex(2147483647) |
| 744 | + .setTimeRange(timeRange) |
| 745 | + .build(); |
| 746 | + List<BufferedRange> bufferedRanges = new ArrayList<>(); |
| 747 | + bufferedRanges.add(bufferedRange); |
| 748 | + |
| 749 | + ClientInfo clientInfoTest = ClientInfo.newBuilder() |
| 750 | + .setClientName(ClientName.WEB) |
| 751 | + .setClientVersion("2.20250222.10.00") |
| 752 | + .setOsName("Macintosh") |
| 753 | + .setOsVersion("10_15_7") |
| 754 | + .build(); |
| 755 | + |
| 756 | + StreamerContext streamerContext = StreamerContext.newBuilder() |
| 757 | + .setPoToken( |
| 758 | + ByteString.copyFrom( |
| 759 | + Base64.decode(poToken, Base64.URL_SAFE) |
| 760 | + ) |
| 761 | + ) |
| 762 | + .setPlaybackCookie( |
| 763 | + nextRequestPolicy != null ? nextRequestPolicy.getPlaybackCookie() : ByteString.EMPTY |
| 764 | + ) |
| 765 | + .setClientInfo(clientInfoTest) |
| 766 | + .addAllSabrContexts(createSabrContexts()) |
| 767 | + .addAllUnsentSabrContexts(createUnsentSabrContexts()) |
| 768 | + .build(); |
| 769 | + |
689 | 770 | return VideoPlaybackAbrRequest.newBuilder() |
690 | | - .setClientAbrState(getClientAbrState()) |
691 | | - .addAllPreferredVideoFormatIds(selectedVideoFormatIds) |
692 | | - .addAllPreferredAudioFormatIds(selectedAudioFormatIds) |
| 771 | + .setClientAbrState(clientAbrStateTest) |
| 772 | + .addAllPreferredVideoFormatIds(preferredVideoFormats) |
| 773 | + .addAllPreferredAudioFormatIds(preferredAudioFormats) |
693 | 774 | .addAllPreferredSubtitleFormatIds(selectedCaptionFormatIds) |
694 | | - .addAllSelectedFormatIds(getSelectedFormatIds()) |
| 775 | + .addAllSelectedFormatIds(selectedFormats) |
| 776 | + .addAllBufferedRanges(bufferedRanges) |
695 | 777 | .setVideoPlaybackUstreamerConfig( |
696 | 778 | ByteString.copyFrom( |
697 | 779 | Base64.decode(videoPlaybackUstreamerConfig, Base64.URL_SAFE) |
698 | 780 | ) |
699 | 781 | ) |
700 | | - .setStreamerContext(createStreamerContext()) |
701 | | - .addAllBufferedRanges(createBufferedRanges()) |
| 782 | + .setStreamerContext(streamerContext) |
702 | 783 | .build(); |
703 | 784 | } |
704 | 785 |
|
|
0 commit comments