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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 } | 1033 } |
1034 | 1034 |
1035 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( | 1035 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( |
1036 std::unique_ptr<MediaTracks> tracks) { | 1036 std::unique_ptr<MediaTracks> tracks) { |
1037 // For MSE/chunk_demuxer case the media track updates are handled by | 1037 // For MSE/chunk_demuxer case the media track updates are handled by |
1038 // WebSourceBufferImpl. | 1038 // WebSourceBufferImpl. |
1039 DCHECK(demuxer_.get()); | 1039 DCHECK(demuxer_.get()); |
1040 DCHECK(!chunk_demuxer_); | 1040 DCHECK(!chunk_demuxer_); |
1041 | 1041 |
1042 // Report the media track information to blink. | 1042 // Report the media track information to blink. |
1043 bool first_audio_track = true; | |
xhwang
2017/03/27 19:13:53
is_first_audio_track ?
servolk
2017/03/27 22:34:12
Done.
| |
1044 bool first_video_track = true; | |
1043 for (const auto& track : tracks->tracks()) { | 1045 for (const auto& track : tracks->tracks()) { |
1044 if (track->type() == MediaTrack::Audio) { | 1046 if (track->type() == MediaTrack::Audio) { |
1045 client_->addAudioTrack(blink::WebString::fromUTF8(track->id()), | 1047 client_->addAudioTrack(blink::WebString::fromUTF8(track->id()), |
1046 blink::WebMediaPlayerClient::AudioTrackKindMain, | 1048 blink::WebMediaPlayerClient::AudioTrackKindMain, |
1047 blink::WebString::fromUTF8(track->label()), | 1049 blink::WebString::fromUTF8(track->label()), |
1048 blink::WebString::fromUTF8(track->language()), | 1050 blink::WebString::fromUTF8(track->language()), |
1049 /*enabled*/ true); | 1051 /*enabled*/ first_audio_track); |
xhwang
2017/03/27 19:13:53
This line doesn't make sense now :)
servolk
2017/03/27 22:34:12
If you are talking about the comment, it still doe
xhwang
2017/03/29 00:16:47
I see. Thanks for the context. I think this style
servolk
2017/03/29 01:49:33
Ok, I guess I can completely remove the parameter
| |
1052 first_audio_track = false; | |
1050 } else if (track->type() == MediaTrack::Video) { | 1053 } else if (track->type() == MediaTrack::Video) { |
1051 client_->addVideoTrack(blink::WebString::fromUTF8(track->id()), | 1054 client_->addVideoTrack(blink::WebString::fromUTF8(track->id()), |
1052 blink::WebMediaPlayerClient::VideoTrackKindMain, | 1055 blink::WebMediaPlayerClient::VideoTrackKindMain, |
1053 blink::WebString::fromUTF8(track->label()), | 1056 blink::WebString::fromUTF8(track->label()), |
1054 blink::WebString::fromUTF8(track->language()), | 1057 blink::WebString::fromUTF8(track->language()), |
1055 /*selected*/ true); | 1058 /*selected*/ first_video_track); |
xhwang
2017/03/27 19:13:53
ditto
servolk
2017/03/27 22:34:12
Acknowledged.
| |
1059 first_video_track = false; | |
1056 } else { | 1060 } else { |
1057 // Text tracks are not supported through this code path yet. | 1061 // Text tracks are not supported through this code path yet. |
1058 NOTREACHED(); | 1062 NOTREACHED(); |
1059 } | 1063 } |
1060 } | 1064 } |
1061 } | 1065 } |
1062 | 1066 |
1063 void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) { | 1067 void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) { |
1064 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1068 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1065 DCHECK(cdm); | 1069 DCHECK(cdm); |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2332 | 2336 |
2333 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2337 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
2334 DCHECK(data_source_ || chunk_demuxer_); | 2338 DCHECK(data_source_ || chunk_demuxer_); |
2335 if (data_source_) | 2339 if (data_source_) |
2336 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2340 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
2337 else | 2341 else |
2338 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2342 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
2339 } | 2343 } |
2340 | 2344 |
2341 } // namespace media | 2345 } // namespace media |
OLD | NEW |