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_codec_bridge.h" | 5 #include "media/base/android/media_codec_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 return true; | 168 return true; |
| 169 | 169 |
| 170 std::string codec_type = AndroidMimeTypeToCodecType(mime_type); | 170 std::string codec_type = AndroidMimeTypeToCodecType(mime_type); |
| 171 std::vector<media::MediaCodecBridge::CodecsInfo> codecs_info = | 171 std::vector<media::MediaCodecBridge::CodecsInfo> codecs_info = |
| 172 MediaCodecBridge::GetCodecsInfo(); | 172 MediaCodecBridge::GetCodecsInfo(); |
| 173 for (size_t i = 0; i < codecs_info.size(); ++i) { | 173 for (size_t i = 0; i < codecs_info.size(); ++i) { |
| 174 if (codecs_info[i].codecs == codec_type && | 174 if (codecs_info[i].codecs == codec_type && |
| 175 codecs_info[i].direction == direction) { | 175 codecs_info[i].direction == direction) { |
| 176 // It would be nice if MediaCodecInfo externalized some notion of | 176 // It would be nice if MediaCodecInfo externalized some notion of |
| 177 // HW-acceleration but it doesn't. Android Media guidance is that the | 177 // HW-acceleration but it doesn't. Android Media guidance is that the |
| 178 // prefix below is always used for SW decoders, so that's what we use. | 178 // "OMX.google" prefix is always used for SW decoders, so that's what we |
| 179 if (!StartsWithASCII(codecs_info[i].name, "OMX.google.", true)) | 179 // use. "OMX.SEC.vp8.dec" codec don't work when trying to decode to a |
| 180 return false; | 180 // surface, so report it as SW decoder as well. |
|
qinmin
2014/09/26 05:00:28
the comments is wierd. This function is checking w
AlexGlaznev
2014/09/26 18:01:37
Done.
| |
| 181 DVLOG(1) << __PRETTY_FUNCTION__ << "Default codec for " << mime_type << | |
| 182 ": " << codecs_info[i].name; | |
| 183 return (StartsWithASCII(codecs_info[i].name, "OMX.google.", true) || | |
| 184 StartsWithASCII(codecs_info[i].name, "OMX.SEC.", true)); | |
| 181 } | 185 } |
| 182 } | 186 } |
| 183 return true; | 187 return true; |
| 184 } | 188 } |
| 185 | 189 |
| 186 MediaCodecBridge::MediaCodecBridge(const std::string& mime, | 190 MediaCodecBridge::MediaCodecBridge(const std::string& mime, |
| 187 bool is_secure, | 191 bool is_secure, |
| 188 MediaCodecDirection direction) { | 192 MediaCodecDirection direction) { |
| 189 JNIEnv* env = AttachCurrentThread(); | 193 JNIEnv* env = AttachCurrentThread(); |
| 190 CHECK(env); | 194 CHECK(env); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 JNIEnv* env = AttachCurrentThread(); | 742 JNIEnv* env = AttachCurrentThread(); |
| 739 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( | 743 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( |
| 740 env, media_codec(), width, height); | 744 env, media_codec(), width, height); |
| 741 } | 745 } |
| 742 | 746 |
| 743 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { | 747 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { |
| 744 return RegisterNativesImpl(env); | 748 return RegisterNativesImpl(env); |
| 745 } | 749 } |
| 746 | 750 |
| 747 } // namespace media | 751 } // namespace media |
| OLD | NEW |