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

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

Issue 1935873002: Implement disabling and enabling media tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-control2
Patch Set: rebase Created 4 years, 5 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/blink/webmediaplayer_impl.h ('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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 560
561 return pipeline_metadata_.has_video; 561 return pipeline_metadata_.has_video;
562 } 562 }
563 563
564 bool WebMediaPlayerImpl::hasAudio() const { 564 bool WebMediaPlayerImpl::hasAudio() const {
565 DCHECK(main_task_runner_->BelongsToCurrentThread()); 565 DCHECK(main_task_runner_->BelongsToCurrentThread());
566 566
567 return pipeline_metadata_.has_audio; 567 return pipeline_metadata_.has_audio;
568 } 568 }
569 569
570 void WebMediaPlayerImpl::enabledAudioTracksChanged(
571 const blink::WebVector<blink::WebMediaPlayer::TrackId>& enabledTrackIds) {
572 DCHECK(main_task_runner_->BelongsToCurrentThread());
573
574 std::ostringstream logstr;
575 std::vector<MediaTrack::Id> enabledMediaTrackIds;
576 for (const auto& blinkTrackId : enabledTrackIds) {
577 MediaTrack::Id track_id = blinkTrackId.utf8().data();
578 logstr << track_id << " ";
579 enabledMediaTrackIds.push_back(track_id);
580 }
581 MEDIA_LOG(INFO, media_log_) << "Enabled audio tracks: [" << logstr.str()
582 << "]";
583 pipeline_.OnEnabledAudioTracksChanged(enabledMediaTrackIds);
584 }
585
586 void WebMediaPlayerImpl::selectedVideoTrackChanged(
587 blink::WebMediaPlayer::TrackId* selectedTrackId) {
588 DCHECK(main_task_runner_->BelongsToCurrentThread());
589
590 std::ostringstream logstr;
591 std::vector<MediaTrack::Id> selectedVideoMediaTrackId;
592 if (selectedTrackId) {
593 selectedVideoMediaTrackId.push_back(selectedTrackId->utf8().data());
594 logstr << selectedVideoMediaTrackId[0];
595 }
596 MEDIA_LOG(INFO, media_log_) << "Selected video track: [" << logstr.str()
597 << "]";
598 pipeline_.OnSelectedVideoTrackChanged(selectedVideoMediaTrackId);
599 }
600
570 blink::WebSize WebMediaPlayerImpl::naturalSize() const { 601 blink::WebSize WebMediaPlayerImpl::naturalSize() const {
571 DCHECK(main_task_runner_->BelongsToCurrentThread()); 602 DCHECK(main_task_runner_->BelongsToCurrentThread());
572 603
573 return blink::WebSize(pipeline_metadata_.natural_size); 604 return blink::WebSize(pipeline_metadata_.natural_size);
574 } 605 }
575 606
576 bool WebMediaPlayerImpl::paused() const { 607 bool WebMediaPlayerImpl::paused() const {
577 DCHECK(main_task_runner_->BelongsToCurrentThread()); 608 DCHECK(main_task_runner_->BelongsToCurrentThread());
578 609
579 #if defined(OS_ANDROID) // WMPI_CAST 610 #if defined(OS_ANDROID) // WMPI_CAST
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 if (isRemote()) 1690 if (isRemote())
1660 return; 1691 return;
1661 #endif 1692 #endif
1662 1693
1663 // Idle timeout chosen arbitrarily. 1694 // Idle timeout chosen arbitrarily.
1664 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), 1695 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
1665 this, &WebMediaPlayerImpl::OnPause); 1696 this, &WebMediaPlayerImpl::OnPause);
1666 } 1697 }
1667 1698
1668 } // namespace media 1699 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698