Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/mime_util_internal.h" | 5 #include "media/base/mime_util_internal.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
| 13 #include "media/base/media_client.h" | |
| 13 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
| 14 #include "media/base/video_codecs.h" | 15 #include "media/base/video_codecs.h" |
| 15 | 16 |
| 16 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
| 17 #include "base/android/build_info.h" | 18 #include "base/android/build_info.h" |
| 18 #include "media/base/android/media_codec_util.h" | 19 #include "media/base/android/media_codec_util.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 namespace internal { | 23 namespace internal { |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 671 #endif | 672 #endif |
| 672 | 673 |
| 673 case H264PROFILE_BASELINE: | 674 case H264PROFILE_BASELINE: |
| 674 case H264PROFILE_MAIN: | 675 case H264PROFILE_MAIN: |
| 675 case H264PROFILE_HIGH: | 676 case H264PROFILE_HIGH: |
| 676 *is_ambiguous = !IsValidH264Level(level_idc); | 677 *is_ambiguous = !IsValidH264Level(level_idc); |
| 677 break; | 678 break; |
| 678 default: | 679 default: |
| 679 *is_ambiguous = true; | 680 *is_ambiguous = true; |
| 680 } | 681 } |
| 682 if (GetMediaClient()) { | |
| 683 return GetMediaClient()->IsSupportedVideoConfig(kCodecH264, profile, | |
|
chcunningham
2016/07/22 00:54:41
This method is called StringToCodec, and its heade
ddorwin
2016/07/22 02:06:37
Agreed about the naming. There are other issues, s
servolk
2016/07/22 02:26:09
David, do you mean MSE's IsTypeSupported? It actua
servolk
2016/07/22 02:26:09
I agree with this, but actually performing that is
servolk
2016/07/22 03:06:28
Done in patchset #4
| |
| 684 level_idc); | |
| 685 } | |
| 681 return true; | 686 return true; |
| 682 } | 687 } |
| 683 | 688 |
| 684 if (ParseVp9CodecID(mime_type_lower_case, codec_id, &profile)) { | 689 if (ParseVp9CodecID(mime_type_lower_case, codec_id, &profile)) { |
| 685 *codec = MimeUtil::VP9; | 690 *codec = MimeUtil::VP9; |
| 686 switch (profile) { | 691 switch (profile) { |
| 687 case VP9PROFILE_PROFILE0: | 692 case VP9PROFILE_PROFILE0: |
| 688 // Profile 0 should always be supported if VP9 is supported. | 693 // Profile 0 should always be supported if VP9 is supported. |
| 689 *is_ambiguous = false; | 694 *is_ambiguous = false; |
| 690 break; | 695 break; |
| 691 default: | 696 default: |
| 692 // We don't know if the underlying platform supports these profiles. | 697 // We don't know if the underlying platform supports these profiles. |
| 693 // Need to add platform level querying to get supported profiles | 698 // Need to add platform level querying to get supported profiles |
| 694 // (crbug/604566). | 699 // (crbug/604566). |
| 695 *is_ambiguous = true; | 700 *is_ambiguous = true; |
| 696 } | 701 } |
| 702 if (GetMediaClient()) { | |
| 703 // TODO(servolk): Add VP9 level info when it becomes available in VP9 | |
| 704 // codec ids. | |
| 705 return GetMediaClient()->IsSupportedVideoConfig(kCodecVP9, profile, 1); | |
| 706 } | |
| 697 return true; | 707 return true; |
| 698 } | 708 } |
| 699 | 709 |
| 700 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 710 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
| 701 if (ParseHEVCCodecId(codec_id, &profile, &level_idc)) { | 711 if (ParseHEVCCodecId(codec_id, &profile, &level_idc)) { |
| 702 // TODO(servolk): Set |is_ambiguous| to true for now to make CanPlayType | 712 *codec = MimeUtil::HEVC; |
| 703 // return 'maybe' for HEVC codec ids, instead of probably. This needs to be | 713 if (GetMediaClient()) { |
| 704 // changed to false after adding platform-level HEVC profile and level | 714 *is_ambiguous = false; |
| 705 // checks, see crbug.com/601949. | 715 return GetMediaClient()->IsSupportedVideoConfig(kCodecHEVC, profile, |
| 716 level_idc); | |
| 717 } | |
| 706 *is_ambiguous = true; | 718 *is_ambiguous = true; |
| 707 *codec = MimeUtil::HEVC; | |
| 708 return true; | 719 return true; |
| 709 } | 720 } |
| 710 #endif | 721 #endif |
| 711 | 722 |
| 712 DVLOG(4) << __FUNCTION__ << ": Unrecognized codec id " << codec_id; | 723 DVLOG(4) << __FUNCTION__ << ": Unrecognized codec id " << codec_id; |
| 713 return false; | 724 return false; |
| 714 } | 725 } |
| 715 | 726 |
| 716 bool MimeUtil::IsCodecSupported(Codec codec, | 727 bool MimeUtil::IsCodecSupported(Codec codec, |
| 717 const std::string& mime_type_lower_case, | 728 const std::string& mime_type_lower_case, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 const std::string& mime_type_lower_case, | 784 const std::string& mime_type_lower_case, |
| 774 bool is_encrypted) const { | 785 bool is_encrypted) const { |
| 775 Codec default_codec = Codec::INVALID_CODEC; | 786 Codec default_codec = Codec::INVALID_CODEC; |
| 776 if (!GetDefaultCodecLowerCase(mime_type_lower_case, &default_codec)) | 787 if (!GetDefaultCodecLowerCase(mime_type_lower_case, &default_codec)) |
| 777 return false; | 788 return false; |
| 778 return IsCodecSupported(default_codec, mime_type_lower_case, is_encrypted); | 789 return IsCodecSupported(default_codec, mime_type_lower_case, is_encrypted); |
| 779 } | 790 } |
| 780 | 791 |
| 781 } // namespace internal | 792 } // namespace internal |
| 782 } // namespace media | 793 } // namespace media |
| OLD | NEW |