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 12 matching lines...) Expand all Loading... |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/task_runner_util.h" | 24 #include "base/task_runner_util.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
28 #include "cc/blink/web_layer_impl.h" | 28 #include "cc/blink/web_layer_impl.h" |
29 #include "cc/layers/video_layer.h" | 29 #include "cc/layers/video_layer.h" |
30 #include "media/audio/null_audio_sink.h" | 30 #include "media/audio/null_audio_sink.h" |
31 #include "media/base/bind_to_current_loop.h" | 31 #include "media/base/bind_to_current_loop.h" |
32 #include "media/base/cdm_context.h" | 32 #include "media/base/cdm_context.h" |
| 33 #include "media/base/content_decryption_module.h" |
33 #include "media/base/limits.h" | 34 #include "media/base/limits.h" |
34 #include "media/base/media_content_type.h" | 35 #include "media/base/media_content_type.h" |
35 #include "media/base/media_keys.h" | |
36 #include "media/base/media_log.h" | 36 #include "media/base/media_log.h" |
37 #include "media/base/media_switches.h" | 37 #include "media/base/media_switches.h" |
38 #include "media/base/media_url_demuxer.h" | 38 #include "media/base/media_url_demuxer.h" |
39 #include "media/base/text_renderer.h" | 39 #include "media/base/text_renderer.h" |
40 #include "media/base/timestamp_constants.h" | 40 #include "media/base/timestamp_constants.h" |
41 #include "media/base/video_frame.h" | 41 #include "media/base/video_frame.h" |
42 #include "media/blink/texttrack_impl.h" | 42 #include "media/blink/texttrack_impl.h" |
43 #include "media/blink/watch_time_reporter.h" | 43 #include "media/blink/watch_time_reporter.h" |
44 #include "media/blink/webaudiosourceprovider_impl.h" | 44 #include "media/blink/webaudiosourceprovider_impl.h" |
45 #include "media/blink/webcontentdecryptionmodule_impl.h" | 45 #include "media/blink/webcontentdecryptionmodule_impl.h" |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 blink::WebContentDecryptionModule* cdm, | 911 blink::WebContentDecryptionModule* cdm, |
912 blink::WebContentDecryptionModuleResult result) { | 912 blink::WebContentDecryptionModuleResult result) { |
913 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 913 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
914 | 914 |
915 // Once the CDM is set it can't be cleared as there may be frames being | 915 // Once the CDM is set it can't be cleared as there may be frames being |
916 // decrypted on other threads. So fail this request. | 916 // decrypted on other threads. So fail this request. |
917 // http://crbug.com/462365#c7. | 917 // http://crbug.com/462365#c7. |
918 if (!cdm) { | 918 if (!cdm) { |
919 result.completeWithError( | 919 result.completeWithError( |
920 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0, | 920 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0, |
921 "The existing MediaKeys object cannot be removed at this time."); | 921 "The existing ContentDecryptionModule object cannot be removed at this " |
| 922 "time."); |
922 return; | 923 return; |
923 } | 924 } |
924 | 925 |
925 // Create a local copy of |result| to avoid problems with the callback | 926 // Create a local copy of |result| to avoid problems with the callback |
926 // getting passed to the media thread and causing |result| to be destructed | 927 // getting passed to the media thread and causing |result| to be destructed |
927 // on the wrong thread in some failure conditions. Blink should prevent | 928 // on the wrong thread in some failure conditions. Blink should prevent |
928 // multiple simultaneous calls. | 929 // multiple simultaneous calls. |
929 DCHECK(!set_cdm_result_); | 930 DCHECK(!set_cdm_result_); |
930 set_cdm_result_.reset(new blink::WebContentDecryptionModuleResult(result)); | 931 set_cdm_result_.reset(new blink::WebContentDecryptionModuleResult(result)); |
931 | 932 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 } else { | 982 } else { |
982 // Text tracks are not supported through this code path yet. | 983 // Text tracks are not supported through this code path yet. |
983 NOTREACHED(); | 984 NOTREACHED(); |
984 } | 985 } |
985 } | 986 } |
986 } | 987 } |
987 | 988 |
988 void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) { | 989 void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) { |
989 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 990 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
990 DCHECK(cdm); | 991 DCHECK(cdm); |
991 scoped_refptr<MediaKeys> cdm_reference = | 992 scoped_refptr<ContentDecryptionModule> cdm_reference = |
992 ToWebContentDecryptionModuleImpl(cdm)->GetCdm(); | 993 ToWebContentDecryptionModuleImpl(cdm)->GetCdm(); |
993 if (!cdm_reference) { | 994 if (!cdm_reference) { |
994 NOTREACHED(); | 995 NOTREACHED(); |
995 OnCdmAttached(false); | 996 OnCdmAttached(false); |
996 return; | 997 return; |
997 } | 998 } |
998 | 999 |
999 CdmContext* cdm_context = cdm_reference->GetCdmContext(); | 1000 CdmContext* cdm_context = cdm_reference->GetCdmContext(); |
1000 if (!cdm_context) { | 1001 if (!cdm_context) { |
1001 OnCdmAttached(false); | 1002 OnCdmAttached(false); |
(...skipping 24 matching lines...) Expand all Loading... |
1026 set_cdm_result_.reset(); | 1027 set_cdm_result_.reset(); |
1027 } | 1028 } |
1028 | 1029 |
1029 return; | 1030 return; |
1030 } | 1031 } |
1031 | 1032 |
1032 pending_cdm_ = nullptr; | 1033 pending_cdm_ = nullptr; |
1033 if (set_cdm_result_) { | 1034 if (set_cdm_result_) { |
1034 set_cdm_result_->completeWithError( | 1035 set_cdm_result_->completeWithError( |
1035 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 1036 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
1036 "Unable to set MediaKeys object"); | 1037 "Unable to set ContentDecryptionModule object"); |
1037 set_cdm_result_.reset(); | 1038 set_cdm_result_.reset(); |
1038 } | 1039 } |
1039 } | 1040 } |
1040 | 1041 |
1041 void WebMediaPlayerImpl::OnPipelineSeeked(bool time_updated) { | 1042 void WebMediaPlayerImpl::OnPipelineSeeked(bool time_updated) { |
1042 seeking_ = false; | 1043 seeking_ = false; |
1043 seek_time_ = base::TimeDelta(); | 1044 seek_time_ = base::TimeDelta(); |
1044 if (paused_) { | 1045 if (paused_) { |
1045 #if defined(OS_ANDROID) // WMPI_CAST | 1046 #if defined(OS_ANDROID) // WMPI_CAST |
1046 if (isRemote()) { | 1047 if (isRemote()) { |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 watch_time_reporter_->OnShown(); | 1980 watch_time_reporter_->OnShown(); |
1980 } | 1981 } |
1981 | 1982 |
1982 bool WebMediaPlayerImpl::IsHidden() const { | 1983 bool WebMediaPlayerImpl::IsHidden() const { |
1983 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1984 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1984 | 1985 |
1985 return delegate_ && delegate_->IsHidden(); | 1986 return delegate_ && delegate_->IsHidden(); |
1986 } | 1987 } |
1987 | 1988 |
1988 } // namespace media | 1989 } // namespace media |
OLD | NEW |