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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2718483003: Use base::Optional for selected video track. (Closed)
Patch Set: rebase Created 3 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 } 664 }
665 MEDIA_LOG(INFO, media_log_) << "Enabled audio tracks: [" << logstr.str() 665 MEDIA_LOG(INFO, media_log_) << "Enabled audio tracks: [" << logstr.str()
666 << "]"; 666 << "]";
667 pipeline_.OnEnabledAudioTracksChanged(enabledMediaTrackIds); 667 pipeline_.OnEnabledAudioTracksChanged(enabledMediaTrackIds);
668 } 668 }
669 669
670 void WebMediaPlayerImpl::selectedVideoTrackChanged( 670 void WebMediaPlayerImpl::selectedVideoTrackChanged(
671 blink::WebMediaPlayer::TrackId* selectedTrackId) { 671 blink::WebMediaPlayer::TrackId* selectedTrackId) {
672 DCHECK(main_task_runner_->BelongsToCurrentThread()); 672 DCHECK(main_task_runner_->BelongsToCurrentThread());
673 673
674 std::ostringstream logstr; 674 base::Optional<MediaTrack::Id> selected_video_track_id;
675 std::vector<MediaTrack::Id> selectedVideoMediaTrackId; 675 if (selectedTrackId && !video_track_disabled_)
676 if (selectedTrackId && !video_track_disabled_) { 676 selected_video_track_id = MediaTrack::Id(selectedTrackId->utf8().data());
677 selectedVideoMediaTrackId.push_back(selectedTrackId->utf8().data()); 677 MEDIA_LOG(INFO, media_log_) << "Selected video track: ["
678 logstr << selectedVideoMediaTrackId[0]; 678 << selected_video_track_id.value_or("") << "]";
679 } 679 pipeline_.OnSelectedVideoTrackChanged(selected_video_track_id);
680 MEDIA_LOG(INFO, media_log_) << "Selected video track: [" << logstr.str()
681 << "]";
682 pipeline_.OnSelectedVideoTrackChanged(selectedVideoMediaTrackId);
683 } 680 }
684 681
685 blink::WebSize WebMediaPlayerImpl::naturalSize() const { 682 blink::WebSize WebMediaPlayerImpl::naturalSize() const {
686 DCHECK(main_task_runner_->BelongsToCurrentThread()); 683 DCHECK(main_task_runner_->BelongsToCurrentThread());
687 684
688 return blink::WebSize(pipeline_metadata_.natural_size); 685 return blink::WebSize(pipeline_metadata_.natural_size);
689 } 686 }
690 687
691 bool WebMediaPlayerImpl::paused() const { 688 bool WebMediaPlayerImpl::paused() const {
692 DCHECK(main_task_runner_->BelongsToCurrentThread()); 689 DCHECK(main_task_runner_->BelongsToCurrentThread());
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 2294
2298 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { 2295 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
2299 DCHECK(data_source_ || chunk_demuxer_); 2296 DCHECK(data_source_ || chunk_demuxer_);
2300 if (data_source_) 2297 if (data_source_)
2301 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); 2298 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration);
2302 else 2299 else
2303 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); 2300 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
2304 } 2301 }
2305 2302
2306 } // namespace media 2303 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698