-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add {stream} opt to custom protocol registry to configure media…
… player
- Loading branch information
Showing
8 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Paul Frazee <pfrazee@gmail.com> | ||
Date: Tue, 28 Apr 2020 17:32:18 -0500 | ||
Subject: feat: add streaming-protocol registry to multibuffer_data_source | ||
|
||
blink::WebMediaPlayerImpl - which provides the <video> and <audio> behaviors - needs to know | ||
whether a data source will stream or fully buffer the response. It determines this behavior | ||
with MultibufferDataSource::AssumeFullyBuffered() which has http/s hardwired. An incorrect | ||
determination will cause the video/audio to fail playing. | ||
|
||
This patch adds a list of "streaming protocols" to the MultibufferDataSource in order to allow | ||
other protocols to register their streaming behavior. MultibufferDataSource::AssumeFullyBuffered() | ||
then refers to the list so that it can correctly determine the data source's settings. | ||
|
||
diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc | ||
index 0f6ae1fb8b4ff9f24ce3f407b7359e016fc6de5f..3f7469376b70b0fb9ab623cc5b415a69a5640cf0 100644 | ||
--- a/media/blink/multibuffer_data_source.cc | ||
+++ b/media/blink/multibuffer_data_source.cc | ||
@@ -65,10 +65,20 @@ const int kUpdateBufferSizeFrequency = 32; | ||
// How long to we delay a seek after a read? | ||
constexpr base::TimeDelta kSeekDelay = base::TimeDelta::FromMilliseconds(20); | ||
|
||
+// Schemes that can stream their responses. | ||
+std::vector<std::string> streaming_schemes = { | ||
+ url::kHttpsScheme, | ||
+ url::kHttpScheme | ||
+}; | ||
+ | ||
} // namespace | ||
|
||
namespace media { | ||
|
||
+void AddStreamingScheme(const char* new_scheme) { | ||
+ streaming_schemes.push_back(new_scheme); | ||
+} | ||
+ | ||
class MultibufferDataSource::ReadOperation { | ||
public: | ||
ReadOperation(int64_t position, | ||
@@ -158,7 +168,14 @@ bool MultibufferDataSource::media_has_played() const { | ||
|
||
bool MultibufferDataSource::AssumeFullyBuffered() const { | ||
DCHECK(url_data_); | ||
- return !url_data_->url().SchemeIsHTTPOrHTTPS(); | ||
+ | ||
+ const std::string scheme = url_data_->url().scheme(); | ||
+ for (const std::string& streaming_scheme : streaming_schemes) { | ||
+ if (base::LowerCaseEqualsASCII(scheme, streaming_scheme)) { | ||
+ return false; | ||
+ } | ||
+ } | ||
+ return true; | ||
} | ||
|
||
void MultibufferDataSource::SetReader(MultiBufferReader* reader) { | ||
diff --git a/media/blink/multibuffer_data_source.h b/media/blink/multibuffer_data_source.h | ||
index 3da5a7bba5e7cc0f54998a81649f4dd9d78aa7be..938ae6ebc92315b3a75019c3bc8c9058106f7695 100644 | ||
--- a/media/blink/multibuffer_data_source.h | ||
+++ b/media/blink/multibuffer_data_source.h | ||
@@ -30,6 +30,8 @@ class BufferedDataSourceHost; | ||
class MediaLog; | ||
class MultiBufferReader; | ||
|
||
+void MEDIA_BLINK_EXPORT AddStreamingScheme(const char* new_scheme); | ||
+ | ||
// A data source capable of loading URLs and buffering the data using an | ||
// in-memory sliding window. | ||
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters