@@ -12,8 +12,12 @@ This patch adds a list of "streaming protocols" to the MultibufferDataSource in
12
12
other protocols to register their streaming behavior. MultibufferDataSource::AssumeFullyBuffered()
13
13
then refers to the list so that it can correctly determine the data source's settings.
14
14
15
+ This patch also reverts https://chromium-review.googlesource.com/c/chromium/src/+/6431846,
16
+ which removed range-requests-supported on non-http protocols. See https://issues.chromium.org/issues/41161335
17
+ for more information.
18
+
15
19
diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
16
- index 14eeb24b27ae9c3798fac7cfbb2ef53b85250dbe..2ce01bf1d8827a57c666a9d92454e0746396580b 100644
20
+ index 14eeb24b27ae9c3798fac7cfbb2ef53b85250dbe..dfcb69a1bf75af5e315e02702109b958fa8edfcf 100644
17
21
--- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
18
22
+++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
19
23
@@ -11,8 +11,10 @@
@@ -27,28 +31,33 @@ index 14eeb24b27ae9c3798fac7cfbb2ef53b85250dbe..2ce01bf1d8827a57c666a9d92454e074
27
31
#include "media/base/media_log.h"
28
32
#include "net/base/net_errors.h"
29
33
#include "third_party/blink/renderer/platform/media/buffered_data_source_host_impl.h"
30
- @@ -67,8 +69,20 @@ const int kUpdateBufferSizeFrequency = 32;
31
- // How long to we delay a seek after a read?
32
- constexpr base::TimeDelta kSeekDelay = base::Milliseconds(20);
34
+ @@ -69,6 +71,10 @@ constexpr base::TimeDelta kSeekDelay = base::Milliseconds(20);
33
35
34
- + std::vector<std::string>* GetStreamingSchemes() {
35
- + static base::NoDestructor<std::vector<std::string>> streaming_schemes({
36
- + url::kHttpsScheme,
37
- + url::kHttpScheme
38
- + });
39
- + return streaming_schemes.get();
40
- + }
41
- +
42
36
} // namespace
43
37
44
38
+ void AddStreamingScheme(const char* new_scheme) {
45
- + GetStreamingSchemes()->push_back(new_scheme);
39
+ + MultiBufferDataSource:: GetStreamingSchemes()->push_back(new_scheme);
46
40
+ }
47
41
+
48
42
class MultiBufferDataSource::ReadOperation {
49
43
public:
50
44
ReadOperation() = delete;
51
- @@ -149,7 +163,14 @@ bool MultiBufferDataSource::media_has_played() const {
45
+ @@ -143,13 +149,29 @@ MultiBufferDataSource::~MultiBufferDataSource() {
46
+ DCHECK(render_task_runner_->BelongsToCurrentThread());
47
+ }
48
+
49
+ + // static
50
+ + std::vector<std::string>* MultiBufferDataSource::GetStreamingSchemes() {
51
+ + static base::NoDestructor<std::vector<std::string>> streaming_schemes({
52
+ + url::kHttpsScheme,
53
+ + url::kHttpScheme
54
+ + });
55
+ + return streaming_schemes.get();
56
+ + }
57
+ +
58
+ bool MultiBufferDataSource::media_has_played() const {
59
+ return media_has_played_;
60
+ }
52
61
53
62
bool MultiBufferDataSource::AssumeFullyBuffered() const {
54
63
DCHECK(url_data_);
@@ -65,7 +74,7 @@ index 14eeb24b27ae9c3798fac7cfbb2ef53b85250dbe..2ce01bf1d8827a57c666a9d92454e074
65
74
66
75
void MultiBufferDataSource::SetReader(
67
76
diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h
68
- index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..40217c27a4cfc43d3143c7eeb2b1e54d8e20cbf6 100644
77
+ index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..8b49dc182296f7f277981aed29b58947fb0980cb 100644
69
78
--- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h
70
79
+++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h
71
80
@@ -17,6 +17,7 @@
@@ -85,3 +94,49 @@ index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..40217c27a4cfc43d3143c7eeb2b1e54d
85
94
// A data source capable of loading URLs and buffering the data using an
86
95
// in-memory sliding window.
87
96
//
97
+ @@ -63,6 +66,8 @@ class PLATFORM_EXPORT MultiBufferDataSource
98
+ return url_data_->mime_type();
99
+ }
100
+
101
+ + static std::vector<std::string>* GetStreamingSchemes();
102
+ +
103
+ // Method called on the render thread.
104
+ using InitializeCB = base::OnceCallback<void(bool)>;
105
+ void Initialize(InitializeCB init_cb) override;
106
+ diff --git a/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc b/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc
107
+ index 1fdc54c1de28ef0c32fc9a386097d95b48aedcaa..5822251daaa9fa5a49ace1bdad684e0076c225dc 100644
108
+ --- a/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc
109
+ +++ b/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc
110
+ @@ -8,6 +8,7 @@
111
+ #include <stddef.h>
112
+
113
+ #include <utility>
114
+ + #include <algorithm>
115
+
116
+ #include "base/containers/contains.h"
117
+ #include "base/location.h"
118
+ @@ -30,6 +31,7 @@
119
+ #include "third_party/blink/public/platform/web_url_response.h"
120
+ #include "third_party/blink/public/web/web_associated_url_loader.h"
121
+ #include "third_party/blink/renderer/platform/media/cache_util.h"
122
+ + #include "third_party/blink/renderer/platform/media/multi_buffer_data_source.h"
123
+ #include "third_party/blink/renderer/platform/media/resource_fetch_context.h"
124
+ #include "third_party/blink/renderer/platform/media/url_index.h"
125
+ #include "third_party/blink/renderer/platform/weborigin/security_origin.h"
126
+ @@ -313,6 +315,16 @@ void ResourceMultiBufferDataProvider::DidReceiveResponse(
127
+ do_fail = true;
128
+ }
129
+ } else {
130
+ + // For non-HTTP protocols, only set range_supported for registered streaming schemes
131
+ + const std::string scheme = destination_url_data->url().Protocol().Ascii();
132
+ +
133
+ + if (std::ranges::any_of(*MultiBufferDataSource::GetStreamingSchemes(),
134
+ + [&scheme](const std::string& streaming_scheme) {
135
+ + return base::EqualsCaseInsensitiveASCII(scheme, streaming_scheme);
136
+ + })) {
137
+ + destination_url_data->set_range_supported();
138
+ + }
139
+ +
140
+ if (content_length != kPositionNotSpecified) {
141
+ destination_url_data->set_length(content_length + byte_pos());
142
+ }
0 commit comments