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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 563 |
564 return pipeline_metadata_.has_video; | 564 return pipeline_metadata_.has_video; |
565 } | 565 } |
566 | 566 |
567 bool WebMediaPlayerImpl::hasAudio() const { | 567 bool WebMediaPlayerImpl::hasAudio() const { |
568 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 568 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
569 | 569 |
570 return pipeline_metadata_.has_audio; | 570 return pipeline_metadata_.has_audio; |
571 } | 571 } |
572 | 572 |
| 573 void WebMediaPlayerImpl::enabledAudioTracksChanged( |
| 574 const blink::WebVector<blink::WebMediaPlayer::TrackId>& enabledTrackIds) { |
| 575 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 576 |
| 577 std::ostringstream logstr; |
| 578 std::vector<MediaTrack::Id> enabledMediaTrackIds; |
| 579 for (const auto& blinkTrackId : enabledTrackIds) { |
| 580 MediaTrack::Id track_id = blinkTrackId.utf8().data(); |
| 581 logstr << track_id << " "; |
| 582 enabledMediaTrackIds.push_back(track_id); |
| 583 } |
| 584 DVLOG(1) << __FUNCTION__ << " enabled track ids: [" << logstr.str() << "]"; |
| 585 pipeline_.OnEnabledAudioTracksChanged(enabledMediaTrackIds); |
| 586 } |
| 587 |
| 588 void WebMediaPlayerImpl::selectedVideoTrackChanged( |
| 589 blink::WebMediaPlayer::TrackId* selectedTrackId) { |
| 590 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 591 |
| 592 std::ostringstream logstr; |
| 593 std::vector<MediaTrack::Id> selectedVideoMediaTrackId; |
| 594 if (selectedTrackId) { |
| 595 selectedVideoMediaTrackId.push_back(selectedTrackId->utf8().data()); |
| 596 logstr << selectedVideoMediaTrackId[0]; |
| 597 } |
| 598 DVLOG(1) << __FUNCTION__ << " selected track id: [" << logstr.str() << "]"; |
| 599 pipeline_.OnSelectedVideoTrackChanged(selectedVideoMediaTrackId); |
| 600 } |
| 601 |
573 blink::WebSize WebMediaPlayerImpl::naturalSize() const { | 602 blink::WebSize WebMediaPlayerImpl::naturalSize() const { |
574 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 603 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
575 | 604 |
576 return blink::WebSize(pipeline_metadata_.natural_size); | 605 return blink::WebSize(pipeline_metadata_.natural_size); |
577 } | 606 } |
578 | 607 |
579 bool WebMediaPlayerImpl::paused() const { | 608 bool WebMediaPlayerImpl::paused() const { |
580 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 609 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
581 | 610 |
582 #if defined(OS_ANDROID) // WMPI_CAST | 611 #if defined(OS_ANDROID) // WMPI_CAST |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 if (isRemote()) | 1663 if (isRemote()) |
1635 return; | 1664 return; |
1636 #endif | 1665 #endif |
1637 | 1666 |
1638 // Idle timeout chosen arbitrarily. | 1667 // Idle timeout chosen arbitrarily. |
1639 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1668 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
1640 this, &WebMediaPlayerImpl::OnPause); | 1669 this, &WebMediaPlayerImpl::OnPause); |
1641 } | 1670 } |
1642 | 1671 |
1643 } // namespace media | 1672 } // namespace media |
OLD | NEW |