OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "media/base/android/media_codec_direction.h" |
15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
16 | 17 |
17 class GURL; | 18 class GURL; |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 | 21 |
21 class MediaCodecBridge; | 22 class MediaCodecBridge; |
22 | 23 |
23 // Helper macro to skip the test if MediaCodecBridge isn't available. | 24 // Helper macro to skip the test if MediaCodecBridge isn't available. |
24 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ | 25 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ |
25 do { \ | 26 do { \ |
26 if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ | 27 if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ |
27 VLOG(0) << "Could not run test - not supported on device."; \ | 28 VLOG(0) << "Could not run test - not supported on device."; \ |
28 return; \ | 29 return; \ |
29 } \ | 30 } \ |
30 } while (0) | 31 } while (0) |
31 | 32 |
32 // Helper macro to skip the test if VP8 decoding isn't supported. | 33 // Helper macro to skip the test if VP8 decoding isn't supported. |
33 #define SKIP_TEST_IF_VP8_DECODER_IS_NOT_SUPPORTED() \ | 34 #define SKIP_TEST_IF_VP8_DECODER_IS_NOT_SUPPORTED() \ |
34 do { \ | 35 do { \ |
35 if (!MediaCodecUtil::IsVp8DecoderAvailable()) { \ | 36 if (!MediaCodecUtil::IsVp8DecoderAvailable()) { \ |
36 VLOG(0) << "Could not run test - not supported on device."; \ | 37 VLOG(0) << "Could not run test - not supported on device."; \ |
37 return; \ | 38 return; \ |
38 } \ | 39 } \ |
39 } while (0) | 40 } while (0) |
40 | 41 |
41 // Codec direction. Keep this in sync with MediaCodecUtil.java. | |
42 enum MediaCodecDirection { | |
43 MEDIA_CODEC_DECODER, | |
44 MEDIA_CODEC_ENCODER, | |
45 }; | |
46 | |
47 class MEDIA_EXPORT MediaCodecUtil { | 42 class MEDIA_EXPORT MediaCodecUtil { |
48 public: | 43 public: |
49 // Returns true if MediaCodec is available on the device. | 44 // Returns true if MediaCodec is available on the device. |
50 // All other static methods check IsAvailable() internally. There's no need | 45 // All other static methods check IsAvailable() internally. There's no need |
51 // to check IsAvailable() explicitly before calling them. | 46 // to check IsAvailable() explicitly before calling them. |
52 static bool IsMediaCodecAvailable(); | 47 static bool IsMediaCodecAvailable(); |
53 | 48 |
54 // Returns true if MediaCodec.setParameters() is available on the device. | 49 // Returns true if MediaCodec.setParameters() is available on the device. |
55 static bool SupportsSetParameters(); | 50 static bool SupportsSetParameters(); |
56 | 51 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Indicates if the decoder is known to fail when flushed. (b/8125974, | 83 // Indicates if the decoder is known to fail when flushed. (b/8125974, |
89 // b/8347958) | 84 // b/8347958) |
90 // When true, the client should work around the issue by releasing the | 85 // When true, the client should work around the issue by releasing the |
91 // decoder and instantiating a new one rather than flushing the current one. | 86 // decoder and instantiating a new one rather than flushing the current one. |
92 static bool CodecNeedsFlushWorkaround(MediaCodecBridge* codec); | 87 static bool CodecNeedsFlushWorkaround(MediaCodecBridge* codec); |
93 }; | 88 }; |
94 | 89 |
95 } // namespace media | 90 } // namespace media |
96 | 91 |
97 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 92 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
OLD | NEW |