OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/html/track/AutomaticTrackSelection.h" | 6 #include "core/html/track/AutomaticTrackSelection.h" |
7 | 7 |
8 #include "core/html/track/TextTrack.h" | 8 #include "core/html/track/TextTrack.h" |
9 #include "core/html/track/TextTrackList.h" | 9 #include "core/html/track/TextTrackList.h" |
10 #include "platform/Language.h" | 10 #include "platform/Language.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 defaultTrack = textTrack; | 116 defaultTrack = textTrack; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 if (m_configuration.textTrackKindUserPreference != TextTrackKindUserPreferen
ce::Default) | 120 if (m_configuration.textTrackKindUserPreference != TextTrackKindUserPreferen
ce::Default) |
121 trackToEnable = preferredTrack; | 121 trackToEnable = preferredTrack; |
122 | 122 |
123 if (!trackToEnable && defaultTrack) | 123 if (!trackToEnable && defaultTrack) |
124 trackToEnable = defaultTrack; | 124 trackToEnable = defaultTrack; |
125 | 125 |
126 if (!trackToEnable && m_configuration.forceEnableSubtitleOrCaptionTrack && g
roup.kind == TrackGroup::CaptionsAndSubtitles) | 126 if (!trackToEnable && m_configuration.forceEnableSubtitleOrCaptionTrack && g
roup.kind == TrackGroup::CaptionsAndSubtitles) { |
127 trackToEnable = fallbackTrack ? fallbackTrack : group.tracks[0]; | 127 if (fallbackTrack) |
| 128 trackToEnable = fallbackTrack; |
| 129 else |
| 130 trackToEnable = group.tracks[0]; |
| 131 } |
128 | 132 |
129 if (currentlyEnabledTracks.size()) { | 133 if (currentlyEnabledTracks.size()) { |
130 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) { | 134 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) { |
131 RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i]; | 135 RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i]; |
132 if (textTrack != trackToEnable) | 136 if (textTrack != trackToEnable) |
133 textTrack->setMode(TextTrack::disabledKeyword()); | 137 textTrack->setMode(TextTrack::disabledKeyword()); |
134 } | 138 } |
135 } | 139 } |
136 | 140 |
137 if (trackToEnable) | 141 if (trackToEnable) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 performAutomaticTextTrackSelection(captionAndSubtitleTracks); | 209 performAutomaticTextTrackSelection(captionAndSubtitleTracks); |
206 if (descriptionTracks.tracks.size()) | 210 if (descriptionTracks.tracks.size()) |
207 performAutomaticTextTrackSelection(descriptionTracks); | 211 performAutomaticTextTrackSelection(descriptionTracks); |
208 if (chapterTracks.tracks.size()) | 212 if (chapterTracks.tracks.size()) |
209 performAutomaticTextTrackSelection(chapterTracks); | 213 performAutomaticTextTrackSelection(chapterTracks); |
210 if (metadataTracks.tracks.size()) | 214 if (metadataTracks.tracks.size()) |
211 enableDefaultMetadataTextTracks(metadataTracks); | 215 enableDefaultMetadataTextTracks(metadataTracks); |
212 } | 216 } |
213 | 217 |
214 } // namespace blink | 218 } // namespace blink |
OLD | NEW |