Chromium Code Reviews| 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 26c96f482d36418c0f2e33185ac42c97bb136068..9abaa3bce51d609685a59abedc3107565bde131f 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -284,6 +284,11 @@ String preloadTypeToString(WebMediaPlayer::Preload preloadType) { |
| return String(); |
| } |
| +bool hasAudioVideoTracks() { |
|
chcunningham
2016/11/29 22:39:18
You can make this a media:: namespaced utilitiy me
mlamouri (slow - plz ping)
2016/11/30 09:34:00
That wouldn't be available from Blink. Or did you
whywhat
2016/11/30 20:45:39
I've put it into HTMLMediaElement as a public stat
|
| + return RuntimeEnabledFeatures::audioVideoTracksEnabled() || |
| + RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled(); |
| +} |
|
mlamouri (slow - plz ping)
2016/11/30 09:34:00
nit: can you name the method hasAudioVideoTracksEn
whywhat
2016/11/30 20:45:39
The meaning is not about the feature enabled but i
|
| + |
| } // anonymous namespace |
| class HTMLMediaElement::AutoplayHelperClientImpl |
| @@ -2565,7 +2570,7 @@ void HTMLMediaElement::audioTrackChanged(AudioTrack* track) { |
| BLINK_MEDIA_LOG << "audioTrackChanged(" << (void*)this |
| << ") trackId= " << String(track->id()) |
| << " enabled=" << boolString(track->enabled()); |
| - DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| + DCHECK(hasAudioVideoTracks()); |
| audioTracks().scheduleChangeEvent(); |
| @@ -2620,7 +2625,7 @@ void HTMLMediaElement::selectedVideoTrackChanged(VideoTrack* track) { |
| BLINK_MEDIA_LOG << "selectedVideoTrackChanged(" << (void*)this |
| << ") selectedTrackId=" |
| << (track->selected() ? String(track->id()) : "none"); |
| - DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| + DCHECK(hasAudioVideoTracks()); |
| if (track->selected()) |
| videoTracks().trackSelected(track->id()); |
| @@ -3860,29 +3865,27 @@ DEFINE_TRACE_WRAPPERS(HTMLMediaElement) { |
| } |
| void HTMLMediaElement::createPlaceholderTracksIfNecessary() { |
| - if (!RuntimeEnabledFeatures::audioVideoTracksEnabled() && |
| - !RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()) { |
| + if (!hasAudioVideoTracks()) |
| 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 (!hasAudioVideoTracks()) |
| return; |
| - } |
| // Enable the first audio track if an audio track hasn't been enabled yet. |
| if (audioTracks().length() > 0 && !audioTracks().hasEnabledTrack()) |