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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 } | 160 } |
161 return false; | 161 return false; |
162 } | 162 } |
163 | 163 |
164 // static | 164 // static |
165 bool MediaCodecBridge::IsKnownUnaccelerated(const std::string& mime_type, | 165 bool MediaCodecBridge::IsKnownUnaccelerated(const std::string& mime_type, |
166 MediaCodecDirection direction) { | 166 MediaCodecDirection direction) { |
167 if (!IsAvailable()) | 167 if (!IsAvailable()) |
168 return true; | 168 return true; |
169 | 169 |
170 bool IsKnownUnaccelerated = true; | |
DaleCurtis
2014/06/20 18:00:31
revert.
KhNo
2014/06/21 15:29:15
Done.
| |
171 | |
170 std::string codec_type = AndroidMimeTypeToCodecType(mime_type); | 172 std::string codec_type = AndroidMimeTypeToCodecType(mime_type); |
171 std::vector<media::MediaCodecBridge::CodecsInfo> codecs_info = | 173 std::vector<media::MediaCodecBridge::CodecsInfo> codecs_info = |
172 MediaCodecBridge::GetCodecsInfo(); | 174 MediaCodecBridge::GetCodecsInfo(); |
173 for (size_t i = 0; i < codecs_info.size(); ++i) { | 175 for (size_t i = 0; i < codecs_info.size(); ++i) { |
174 if (codecs_info[i].codecs == codec_type && | 176 if (codecs_info[i].codecs == codec_type && |
175 codecs_info[i].direction == direction) { | 177 codecs_info[i].direction == direction) { |
176 // It would be nice if MediaCodecInfo externalized some notion of | 178 // It would be nice if MediaCodecInfo externalized some notion of |
177 // HW-acceleration but it doesn't. Android Media guidance is that the | 179 // 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. | 180 // prefix below is always used for SW decoders, so that's what we use. |
179 return StartsWithASCII(codecs_info[i].name, "OMX.google.", true); | 181 if (!StartsWithASCII(codecs_info[i].name, "OMX.google.", true)) |
182 IsKnownUnaccelerated = false; | |
DaleCurtis
2014/06/20 18:00:31
Just change this to "if (!...) return false;"
KhNo
2014/06/21 15:29:15
Thanks DaleCurtis.
| |
180 } | 183 } |
181 } | 184 } |
182 return true; | 185 return IsKnownUnaccelerated; |
DaleCurtis
2014/06/20 18:00:31
revert.
KhNo
2014/06/21 15:29:15
Done.
| |
183 } | 186 } |
184 | 187 |
185 MediaCodecBridge::MediaCodecBridge(const std::string& mime, | 188 MediaCodecBridge::MediaCodecBridge(const std::string& mime, |
186 bool is_secure, | 189 bool is_secure, |
187 MediaCodecDirection direction) { | 190 MediaCodecDirection direction) { |
188 JNIEnv* env = AttachCurrentThread(); | 191 JNIEnv* env = AttachCurrentThread(); |
189 CHECK(env); | 192 CHECK(env); |
190 DCHECK(!mime.empty()); | 193 DCHECK(!mime.empty()); |
191 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime); | 194 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime); |
192 j_media_codec_.Reset( | 195 j_media_codec_.Reset( |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 JNIEnv* env = AttachCurrentThread(); | 740 JNIEnv* env = AttachCurrentThread(); |
738 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( | 741 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( |
739 env, media_codec(), width, height); | 742 env, media_codec(), width, height); |
740 } | 743 } |
741 | 744 |
742 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { | 745 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { |
743 return RegisterNativesImpl(env); | 746 return RegisterNativesImpl(env); |
744 } | 747 } |
745 | 748 |
746 } // namespace media | 749 } // namespace media |
OLD | NEW |