| 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/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "media/base/android/audio_decoder_job.h" | 13 #include "media/base/android/audio_decoder_job.h" |
| 14 #include "media/base/android/media_drm_bridge.h" | 14 #include "media/base/android/media_drm_bridge.h" |
| 15 #include "media/base/android/media_player_manager.h" | 15 #include "media/base/android/media_player_manager.h" |
| 16 #include "media/base/android/video_decoder_job.h" | 16 #include "media/base/android/video_decoder_job.h" |
| 17 #include "media/base/audio_timestamp_helper.h" | 17 #include "media/base/audio_timestamp_helper.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Use 16bit PCM for audio output. Keep this value in sync with the output | 21 // Use 16bit PCM for audio output. Keep this value in sync with the output |
| 22 // format we passed to AudioTrack in MediaCodecBridge. | 22 // format we passed to AudioTrack in MediaCodecBridge. |
| 23 const int kBytesPerAudioOutputSample = 2; | 23 const int kBytesPerAudioOutputSample = 2; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 | 27 |
| 28 // static |
| 29 bool MediaSourcePlayer::IsTypeSupported( |
| 30 const std::vector<uint8>& scheme_uuid, |
| 31 const std::string& security_level, |
| 32 const std::string& container, |
| 33 const std::vector<std::string>& codecs) { |
| 34 if (!MediaDrmBridge::IsCryptoSchemeSupported(scheme_uuid, container)) |
| 35 return false; |
| 36 |
| 37 bool is_secure = MediaDrmBridge::IsSecureDecoderRequired(security_level); |
| 38 for (size_t i = 0; i < codecs.size(); ++i) { |
| 39 if (!MediaCodecBridge::CanDecode(codecs[i], is_secure)) |
| 40 return false; |
| 41 } |
| 42 |
| 43 return true; |
| 44 } |
| 45 |
| 28 MediaSourcePlayer::MediaSourcePlayer( | 46 MediaSourcePlayer::MediaSourcePlayer( |
| 29 int player_id, | 47 int player_id, |
| 30 MediaPlayerManager* manager) | 48 MediaPlayerManager* manager) |
| 31 : MediaPlayerAndroid(player_id, manager), | 49 : MediaPlayerAndroid(player_id, manager), |
| 32 pending_event_(NO_EVENT_PENDING), | 50 pending_event_(NO_EVENT_PENDING), |
| 33 seek_request_id_(0), | 51 seek_request_id_(0), |
| 34 width_(0), | 52 width_(0), |
| 35 height_(0), | 53 height_(0), |
| 36 audio_codec_(kUnknownAudioCodec), | 54 audio_codec_(kUnknownAudioCodec), |
| 37 video_codec_(kUnknownVideoCodec), | 55 video_codec_(kUnknownVideoCodec), |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 684 |
| 667 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { | 685 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { |
| 668 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; | 686 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; |
| 669 DCHECK_NE(event, NO_EVENT_PENDING); | 687 DCHECK_NE(event, NO_EVENT_PENDING); |
| 670 DCHECK(IsEventPending(event)); | 688 DCHECK(IsEventPending(event)); |
| 671 | 689 |
| 672 pending_event_ &= ~event; | 690 pending_event_ &= ~event; |
| 673 } | 691 } |
| 674 | 692 |
| 675 } // namespace media | 693 } // namespace media |
| OLD | NEW |