Chromium Code Reviews| 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/float_util.h" | 14 #include "base/float_util.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "cc/blink/web_layer_impl.h" | 20 #include "cc/blink/web_layer_impl.h" |
| 21 #include "cc/layers/video_layer.h" | 21 #include "cc/layers/video_layer.h" |
| 22 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
| 23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/renderer/render_frame.h" | 24 #include "content/public/renderer/render_frame.h" |
| 25 #include "content/renderer/media/android/renderer_demuxer_android.h" | 25 #include "content/renderer/media/android/renderer_demuxer_android.h" |
| 26 #include "content/renderer/media/android/renderer_media_player_manager.h" | 26 #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 27 #include "content/renderer/media/crypto/key_systems.h" | 27 #include "content/renderer/media/crypto/key_systems.h" |
| 28 #include "content/renderer/media/crypto/render_cdm_factory.h" | |
|
ddorwin
2014/10/16 17:32:51
I really dislike "Render" as a noun. It is a verb
xhwang
2014/10/16 20:08:39
render is used more often than renderer, e.g. rend
ddorwin
2014/10/16 20:33:20
It's about 40/60 in that directory. I would argue
xhwang
2014/10/17 00:11:48
I think we had this discussion before and didn't g
| |
| 28 #include "content/renderer/media/crypto/renderer_cdm_manager.h" | 29 #include "content/renderer/media/crypto/renderer_cdm_manager.h" |
| 29 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 30 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
| 30 #include "content/renderer/render_frame_impl.h" | 31 #include "content/renderer/render_frame_impl.h" |
| 31 #include "content/renderer/render_thread_impl.h" | 32 #include "content/renderer/render_thread_impl.h" |
| 32 #include "gpu/GLES2/gl2extchromium.h" | 33 #include "gpu/GLES2/gl2extchromium.h" |
| 33 #include "gpu/command_buffer/client/gles2_interface.h" | 34 #include "gpu/command_buffer/client/gles2_interface.h" |
| 34 #include "gpu/command_buffer/common/mailbox_holder.h" | 35 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 35 #include "media/base/android/media_common_android.h" | 36 #include "media/base/android/media_common_android.h" |
| 36 #include "media/base/android/media_player_android.h" | 37 #include "media/base/android/media_player_android.h" |
| 37 #include "media/base/bind_to_current_loop.h" | 38 #include "media/base/bind_to_current_loop.h" |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1514 const std::string& key_system, | 1515 const std::string& key_system, |
| 1515 const unsigned char* init_data, | 1516 const unsigned char* init_data, |
| 1516 unsigned init_data_length) { | 1517 unsigned init_data_length) { |
| 1517 if (!IsKeySystemSupported(key_system)) | 1518 if (!IsKeySystemSupported(key_system)) |
| 1518 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; | 1519 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; |
| 1519 | 1520 |
| 1520 // We do not support run-time switching between key systems for now. | 1521 // We do not support run-time switching between key systems for now. |
| 1521 if (current_key_system_.empty()) { | 1522 if (current_key_system_.empty()) { |
| 1522 if (!proxy_decryptor_) { | 1523 if (!proxy_decryptor_) { |
| 1523 proxy_decryptor_.reset(new ProxyDecryptor( | 1524 proxy_decryptor_.reset(new ProxyDecryptor( |
| 1524 cdm_manager_, | 1525 scoped_ptr<media::CdmFactory>(new RenderCdmFactory(cdm_manager_)), |
| 1525 base::Bind(&WebMediaPlayerAndroid::OnKeyAdded, | 1526 base::Bind(&WebMediaPlayerAndroid::OnKeyAdded, |
| 1526 weak_factory_.GetWeakPtr()), | 1527 weak_factory_.GetWeakPtr()), |
| 1527 base::Bind(&WebMediaPlayerAndroid::OnKeyError, | 1528 base::Bind(&WebMediaPlayerAndroid::OnKeyError, |
| 1528 weak_factory_.GetWeakPtr()), | 1529 weak_factory_.GetWeakPtr()), |
| 1529 base::Bind(&WebMediaPlayerAndroid::OnKeyMessage, | 1530 base::Bind(&WebMediaPlayerAndroid::OnKeyMessage, |
| 1530 weak_factory_.GetWeakPtr()))); | 1531 weak_factory_.GetWeakPtr()))); |
| 1531 } | 1532 } |
| 1532 | 1533 |
| 1533 GURL security_origin(frame_->document().securityOrigin().toString()); | 1534 GURL security_origin(frame_->document().securityOrigin().toString()); |
| 1534 if (!proxy_decryptor_->InitializeCDM(key_system, security_origin)) | 1535 if (!proxy_decryptor_->InitializeCDM(key_system, security_origin)) |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1830 | 1831 |
| 1831 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1832 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1832 std::string mime; | 1833 std::string mime; |
| 1833 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1834 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1834 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1835 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1835 return false; | 1836 return false; |
| 1836 return !mime.compare("application/x-mpegurl"); | 1837 return !mime.compare("application/x-mpegurl"); |
| 1837 } | 1838 } |
| 1838 | 1839 |
| 1839 } // namespace content | 1840 } // namespace content |
| OLD | NEW |