Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2532233003: [Video] Add dummy video/audio tracks inactive to select them later. (Closed)
Patch Set: Extracted checks into HTMLMediaElement Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index d340c2f8a6d7a209b81b1663e0c959eaa6dbf93c..8dde859d71c056d734d684819f7d0929698fa6b4 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -399,6 +399,11 @@ bool HTMLMediaElement::isHLSURL(const KURL& url) {
return url.getString().contains("m3u8");
}
+bool HTMLMediaElement::mediaTracksEnabledInternally() {
+ return RuntimeEnabledFeatures::audioVideoTracksEnabled() ||
+ RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled();
+}
+
HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName,
Document& document)
: HTMLElement(tagName, document),
@@ -2560,7 +2565,7 @@ void HTMLMediaElement::audioTrackChanged(AudioTrack* track) {
BLINK_MEDIA_LOG << "audioTrackChanged(" << (void*)this
<< ") trackId= " << String(track->id())
<< " enabled=" << boolString(track->enabled());
- DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
+ DCHECK(mediaTracksEnabledInternally());
audioTracks().scheduleChangeEvent();
@@ -2615,7 +2620,7 @@ void HTMLMediaElement::selectedVideoTrackChanged(VideoTrack* track) {
BLINK_MEDIA_LOG << "selectedVideoTrackChanged(" << (void*)this
<< ") selectedTrackId="
<< (track->selected() ? String(track->id()) : "none");
- DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
+ DCHECK(mediaTracksEnabledInternally());
if (track->selected())
videoTracks().trackSelected(track->id());
@@ -3849,29 +3854,27 @@ DEFINE_TRACE_WRAPPERS(HTMLMediaElement) {
}
void HTMLMediaElement::createPlaceholderTracksIfNecessary() {
- if (!RuntimeEnabledFeatures::audioVideoTracksEnabled() &&
- !RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()) {
+ if (!mediaTracksEnabledInternally())
return;
- }
// Create a placeholder audio track if the player says it has audio but it
// didn't explicitly announce the tracks.
- if (hasAudio() && !audioTracks().length())
+ if (hasAudio() && !audioTracks().length()) {
addAudioTrack("audio", WebMediaPlayerClient::AudioTrackKindMain,
- "Audio Track", "", true);
+ "Audio Track", "", false);
+ }
// Create a placeholder video track if the player says it has video but it
// didn't explicitly announce the tracks.
- if (hasVideo() && !videoTracks().length())
+ if (hasVideo() && !videoTracks().length()) {
addVideoTrack("video", WebMediaPlayerClient::VideoTrackKindMain,
- "Video Track", "", true);
+ "Video Track", "", false);
+ }
}
void HTMLMediaElement::selectInitialTracksIfNecessary() {
- if (!RuntimeEnabledFeatures::audioVideoTracksEnabled() &&
- !RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()) {
+ if (!mediaTracksEnabledInternally())
return;
- }
// Enable the first audio track if an audio track hasn't been enabled yet.
if (audioTracks().length() > 0 && !audioTracks().hasEnabledTrack())
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/Source/modules/mediasource/MediaSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698