OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 } | 1032 } |
1033 | 1033 |
1034 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( | 1034 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( |
1035 std::unique_ptr<MediaTracks> tracks) { | 1035 std::unique_ptr<MediaTracks> tracks) { |
1036 // For MSE/chunk_demuxer case the media track updates are handled by | 1036 // For MSE/chunk_demuxer case the media track updates are handled by |
1037 // WebSourceBufferImpl. | 1037 // WebSourceBufferImpl. |
1038 DCHECK(demuxer_.get()); | 1038 DCHECK(demuxer_.get()); |
1039 DCHECK(!chunk_demuxer_); | 1039 DCHECK(!chunk_demuxer_); |
1040 | 1040 |
1041 // Report the media track information to blink. | 1041 // Report the media track information to blink. |
| 1042 bool first_audio_track = true; |
| 1043 bool first_video_track = true; |
1042 for (const auto& track : tracks->tracks()) { | 1044 for (const auto& track : tracks->tracks()) { |
1043 if (track->type() == MediaTrack::Audio) { | 1045 if (track->type() == MediaTrack::Audio) { |
1044 client_->addAudioTrack(blink::WebString::fromUTF8(track->id()), | 1046 client_->addAudioTrack(blink::WebString::fromUTF8(track->id()), |
1045 blink::WebMediaPlayerClient::AudioTrackKindMain, | 1047 blink::WebMediaPlayerClient::AudioTrackKindMain, |
1046 blink::WebString::fromUTF8(track->label()), | 1048 blink::WebString::fromUTF8(track->label()), |
1047 blink::WebString::fromUTF8(track->language()), | 1049 blink::WebString::fromUTF8(track->language()), |
1048 /*enabled*/ true); | 1050 /*enabled*/ first_audio_track); |
| 1051 first_audio_track = false; |
1049 } else if (track->type() == MediaTrack::Video) { | 1052 } else if (track->type() == MediaTrack::Video) { |
1050 client_->addVideoTrack(blink::WebString::fromUTF8(track->id()), | 1053 client_->addVideoTrack(blink::WebString::fromUTF8(track->id()), |
1051 blink::WebMediaPlayerClient::VideoTrackKindMain, | 1054 blink::WebMediaPlayerClient::VideoTrackKindMain, |
1052 blink::WebString::fromUTF8(track->label()), | 1055 blink::WebString::fromUTF8(track->label()), |
1053 blink::WebString::fromUTF8(track->language()), | 1056 blink::WebString::fromUTF8(track->language()), |
1054 /*selected*/ true); | 1057 /*selected*/ first_video_track); |
| 1058 first_video_track = false; |
1055 } else { | 1059 } else { |
1056 // Text tracks are not supported through this code path yet. | 1060 // Text tracks are not supported through this code path yet. |
1057 NOTREACHED(); | 1061 NOTREACHED(); |
1058 } | 1062 } |
1059 } | 1063 } |
1060 } | 1064 } |
1061 | 1065 |
1062 void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) { | 1066 void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) { |
1063 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1067 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1064 DCHECK(cdm); | 1068 DCHECK(cdm); |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 | 2324 |
2321 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2325 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
2322 DCHECK(data_source_ || chunk_demuxer_); | 2326 DCHECK(data_source_ || chunk_demuxer_); |
2323 if (data_source_) | 2327 if (data_source_) |
2324 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2328 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
2325 else | 2329 else |
2326 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2330 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
2327 } | 2331 } |
2328 | 2332 |
2329 } // namespace media | 2333 } // namespace media |
OLD | NEW |