Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/base/android/media_source_player.h" | 5 #include "media/base/android/media_source_player.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "media/base/android/audio_decoder_job.h" | 12 #include "media/base/android/audio_decoder_job.h" |
| 13 #include "media/base/android/media_drm_bridge.h" | 13 #include "media/base/android/media_drm_bridge.h" |
| 14 #include "media/base/android/media_player_manager.h" | 14 #include "media/base/android/media_player_manager.h" |
| 15 #include "media/base/android/video_decoder_job.h" | 15 #include "media/base/android/video_decoder_job.h" |
| 16 #include "media/base/audio_timestamp_helper.h" | 16 #include "media/base/audio_timestamp_helper.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Use 16bit PCM for audio output. Keep this value in sync with the output | 20 // Use 16bit PCM for audio output. Keep this value in sync with the output |
| 21 // format we passed to AudioTrack in MediaCodecBridge. | 21 // format we passed to AudioTrack in MediaCodecBridge. |
| 22 const int kBytesPerAudioOutputSample = 2; | 22 const int kBytesPerAudioOutputSample = 2; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace media { | 25 namespace media { |
| 26 | 26 |
| 27 // static | |
| 28 bool MediaSourcePlayer::CanPlayType(const std::vector<uint8>& scheme_uuid, | |
| 29 const std::string& security_level, | |
| 30 const std::string& container, | |
| 31 const std::vector<std::string>& codecs) { | |
| 32 if (!MediaDrmBridge::IsCryptoSchemeSupported(scheme_uuid, container)) | |
| 33 return false; | |
| 34 | |
| 35 bool secure = MediaDrmBridge::IsSecureDecoderRequired(security_level); | |
|
ddorwin
2013/08/27 18:14:19
nit: is_secure
Really, is_secure_required, but th
xhwang
2013/08/28 01:21:24
I debated about that. |is_secure| isn't accurate e
ddorwin
2013/08/28 02:28:50
Yes, but bools should generally have an is_ (or si
xhwang
2013/08/28 18:19:15
Changed to is_secure, which is short and fits well
| |
| 36 for (size_t i = 0; i < codecs.size(); ++i) { | |
| 37 if (!MediaCodecBridge::CanPlayType(codecs[i].c_str(), secure)) | |
|
qinmin
2013/08/27 21:41:12
how about putting the for loop inside MediaCodecBr
xhwang
2013/08/28 01:21:24
This function is already complicated (involves Med
| |
| 38 return false; | |
| 39 } | |
| 40 | |
| 41 return true; | |
| 42 } | |
| 43 | |
| 27 MediaSourcePlayer::MediaSourcePlayer( | 44 MediaSourcePlayer::MediaSourcePlayer( |
| 28 int player_id, | 45 int player_id, |
| 29 MediaPlayerManager* manager) | 46 MediaPlayerManager* manager) |
| 30 : MediaPlayerAndroid(player_id, manager), | 47 : MediaPlayerAndroid(player_id, manager), |
| 31 pending_event_(NO_EVENT_PENDING), | 48 pending_event_(NO_EVENT_PENDING), |
| 32 seek_request_id_(0), | 49 seek_request_id_(0), |
| 33 width_(0), | 50 width_(0), |
| 34 height_(0), | 51 height_(0), |
| 35 audio_codec_(kUnknownAudioCodec), | 52 audio_codec_(kUnknownAudioCodec), |
| 36 video_codec_(kUnknownVideoCodec), | 53 video_codec_(kUnknownVideoCodec), |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 if (audio_decoder_job_ && volume_ >= 0) | 674 if (audio_decoder_job_ && volume_ >= 0) |
| 658 audio_decoder_job_.get()->SetVolume(volume_); | 675 audio_decoder_job_.get()->SetVolume(volume_); |
| 659 } | 676 } |
| 660 | 677 |
| 661 bool MediaSourcePlayer::IsProtectedSurfaceRequired() { | 678 bool MediaSourcePlayer::IsProtectedSurfaceRequired() { |
| 662 return is_video_encrypted_ && | 679 return is_video_encrypted_ && |
| 663 drm_bridge_ && drm_bridge_->IsProtectedSurfaceRequired(); | 680 drm_bridge_ && drm_bridge_->IsProtectedSurfaceRequired(); |
| 664 } | 681 } |
| 665 | 682 |
| 666 } // namespace media | 683 } // namespace media |
| OLD | NEW |