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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 } | 841 } |
842 | 842 |
843 // TODO(xhwang): Update this UMA name. https://crbug.com/589251 | 843 // TODO(xhwang): Update this UMA name. https://crbug.com/589251 |
844 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); | 844 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); |
845 | 845 |
846 encrypted_client_->encrypted( | 846 encrypted_client_->encrypted( |
847 ConvertToWebInitDataType(init_data_type), init_data.data(), | 847 ConvertToWebInitDataType(init_data_type), init_data.data(), |
848 base::saturated_cast<unsigned int>(init_data.size())); | 848 base::saturated_cast<unsigned int>(init_data.size())); |
849 } | 849 } |
850 | 850 |
| 851 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( |
| 852 scoped_ptr<MediaTracks> tracks) { |
| 853 // For MSE/chunk_demuxer case the media track updates are handled by |
| 854 // WebSourceBufferImpl. |
| 855 DCHECK(demuxer_.get()); |
| 856 DCHECK(!chunk_demuxer_); |
| 857 } |
| 858 |
851 void WebMediaPlayerImpl::OnWaitingForDecryptionKey() { | 859 void WebMediaPlayerImpl::OnWaitingForDecryptionKey() { |
852 encrypted_client_->didBlockPlaybackWaitingForKey(); | 860 encrypted_client_->didBlockPlaybackWaitingForKey(); |
853 | 861 |
854 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called | 862 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called |
855 // when a key has been successfully added (e.g. OnSessionKeysChange() with | 863 // when a key has been successfully added (e.g. OnSessionKeysChange() with |
856 // |has_additional_usable_key| = true). http://crbug.com/461903 | 864 // |has_additional_usable_key| = true). http://crbug.com/461903 |
857 encrypted_client_->didResumePlaybackBlockedForKey(); | 865 encrypted_client_->didResumePlaybackBlockedForKey(); |
858 } | 866 } |
859 | 867 |
860 void WebMediaPlayerImpl::SetCdm(const CdmAttachedCB& cdm_attached_cb, | 868 void WebMediaPlayerImpl::SetCdm(const CdmAttachedCB& cdm_attached_cb, |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 | 1384 |
1377 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = | 1385 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = |
1378 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnEncryptedMediaInitData); | 1386 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnEncryptedMediaInitData); |
1379 | 1387 |
1380 // Figure out which demuxer to use. | 1388 // Figure out which demuxer to use. |
1381 if (load_type_ != LoadTypeMediaSource) { | 1389 if (load_type_ != LoadTypeMediaSource) { |
1382 DCHECK(!chunk_demuxer_); | 1390 DCHECK(!chunk_demuxer_); |
1383 DCHECK(data_source_); | 1391 DCHECK(data_source_); |
1384 | 1392 |
1385 #if !defined(MEDIA_DISABLE_FFMPEG) | 1393 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 1394 Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb = |
| 1395 base::Bind(&WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated, |
| 1396 base::Unretained(this)); |
| 1397 |
1386 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), | 1398 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), |
1387 encrypted_media_init_data_cb, media_log_)); | 1399 encrypted_media_init_data_cb, |
| 1400 media_tracks_updated_cb, media_log_)); |
1388 #else | 1401 #else |
1389 OnPipelineError(PipelineStatus::DEMUXER_ERROR_COULD_NOT_OPEN); | 1402 OnPipelineError(PipelineStatus::DEMUXER_ERROR_COULD_NOT_OPEN); |
1390 return; | 1403 return; |
1391 #endif | 1404 #endif |
1392 } else { | 1405 } else { |
1393 DCHECK(!chunk_demuxer_); | 1406 DCHECK(!chunk_demuxer_); |
1394 DCHECK(!data_source_); | 1407 DCHECK(!data_source_); |
1395 | 1408 |
1396 chunk_demuxer_ = new ChunkDemuxer( | 1409 chunk_demuxer_ = new ChunkDemuxer( |
1397 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), | 1410 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1609 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
1597 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1610 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
1598 << ", Demuxer: " << demuxer_memory_usage; | 1611 << ", Demuxer: " << demuxer_memory_usage; |
1599 | 1612 |
1600 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1613 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
1601 last_reported_memory_usage_ = current_memory_usage; | 1614 last_reported_memory_usage_ = current_memory_usage; |
1602 adjust_allocated_memory_cb_.Run(delta); | 1615 adjust_allocated_memory_cb_.Run(delta); |
1603 } | 1616 } |
1604 | 1617 |
1605 } // namespace media | 1618 } // namespace media |
OLD | NEW |