Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: media/base/android/media_source_player.cc

Issue 23517002: MediaSourcePlayer implements IsTypeSupported(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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::IsTypeSupported(
29 const std::vector<uint8>& scheme_uuid,
30 const std::string& security_level,
31 const std::string& container,
32 const std::vector<std::string>& codecs) {
33 if (!MediaDrmBridge::IsCryptoSchemeSupported(scheme_uuid, container))
34 return false;
35
36 bool secure = MediaDrmBridge::IsSecureDecoderRequired(security_level);
37 for (size_t i = 0; i < codecs.size(); ++i) {
38 if (!MediaCodecBridge::IsDecoderSupported(codecs[i].c_str(), secure))
ddorwin 2013/08/28 02:28:50 s/Decoder/Codec/? Otherwise, maybe HasDecoder().
xhwang 2013/08/28 18:19:15 Done.
39 return false;
40 }
41
42 return true;
43 }
44
27 MediaSourcePlayer::MediaSourcePlayer( 45 MediaSourcePlayer::MediaSourcePlayer(
28 int player_id, 46 int player_id,
29 MediaPlayerManager* manager) 47 MediaPlayerManager* manager)
30 : MediaPlayerAndroid(player_id, manager), 48 : MediaPlayerAndroid(player_id, manager),
31 pending_event_(NO_EVENT_PENDING), 49 pending_event_(NO_EVENT_PENDING),
32 seek_request_id_(0), 50 seek_request_id_(0),
33 width_(0), 51 width_(0),
34 height_(0), 52 height_(0),
35 audio_codec_(kUnknownAudioCodec), 53 audio_codec_(kUnknownAudioCodec),
36 video_codec_(kUnknownVideoCodec), 54 video_codec_(kUnknownVideoCodec),
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 if (audio_decoder_job_ && volume_ >= 0) 675 if (audio_decoder_job_ && volume_ >= 0)
658 audio_decoder_job_.get()->SetVolume(volume_); 676 audio_decoder_job_.get()->SetVolume(volume_);
659 } 677 }
660 678
661 bool MediaSourcePlayer::IsProtectedSurfaceRequired() { 679 bool MediaSourcePlayer::IsProtectedSurfaceRequired() {
662 return is_video_encrypted_ && 680 return is_video_encrypted_ &&
663 drm_bridge_ && drm_bridge_->IsProtectedSurfaceRequired(); 681 drm_bridge_ && drm_bridge_->IsProtectedSurfaceRequired();
664 } 682 }
665 683
666 } // namespace media 684 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698