| 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 client_->didBlockPlaybackWaitingForKey(); | 692 client_->didBlockPlaybackWaitingForKey(); |
| 693 | 693 |
| 694 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called | 694 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called |
| 695 // when a key has been successfully added (e.g. OnSessionKeysChange() with | 695 // when a key has been successfully added (e.g. OnSessionKeysChange() with |
| 696 // |has_additional_usable_key| = true). http://crbug.com/461903 | 696 // |has_additional_usable_key| = true). http://crbug.com/461903 |
| 697 client_->didResumePlaybackBlockedForKey(); | 697 client_->didResumePlaybackBlockedForKey(); |
| 698 } | 698 } |
| 699 | 699 |
| 700 void WebMediaPlayerImpl::SetCdm(const CdmAttachedCB& cdm_attached_cb, | 700 void WebMediaPlayerImpl::SetCdm(const CdmAttachedCB& cdm_attached_cb, |
| 701 CdmContext* cdm_context) { | 701 CdmContext* cdm_context) { |
| 702 pipeline_.SetCdm(cdm_context, cdm_attached_cb); | 702 // If CDM initialization succeeded, tell the pipeline about it. |
| 703 if (cdm_context) |
| 704 pipeline_.SetCdm(cdm_context, cdm_attached_cb); |
| 703 } | 705 } |
| 704 | 706 |
| 705 void WebMediaPlayerImpl::OnCdmAttached( | 707 void WebMediaPlayerImpl::OnCdmAttached( |
| 706 blink::WebContentDecryptionModuleResult result, | 708 blink::WebContentDecryptionModuleResult result, |
| 707 bool success) { | 709 bool success) { |
| 708 if (success) { | 710 if (success) { |
| 709 result.complete(); | 711 result.complete(); |
| 710 return; | 712 return; |
| 711 } | 713 } |
| 712 | 714 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 | 1015 |
| 1014 // pause() may be called after playback has ended and the HTMLMediaElement | 1016 // pause() may be called after playback has ended and the HTMLMediaElement |
| 1015 // requires that currentTime() == duration() after ending. We want to ensure | 1017 // requires that currentTime() == duration() after ending. We want to ensure |
| 1016 // |paused_time_| matches currentTime() in this case or a future seek() may | 1018 // |paused_time_| matches currentTime() in this case or a future seek() may |
| 1017 // incorrectly discard what it thinks is a seek to the existing time. | 1019 // incorrectly discard what it thinks is a seek to the existing time. |
| 1018 paused_time_ = | 1020 paused_time_ = |
| 1019 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1021 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 } // namespace media | 1024 } // namespace media |
| OLD | NEW |