summaryrefslogtreecommitdiff
path: root/SDL_Core/mobile/android/AndroidVideoStreaming/src/instrumentTest/java/com/batutin/android/androidvideostreaming/media/CodecInfoUtilsTest.java
blob: 9c0fff8d310d86d6908a8948c8428dfcd61d477f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.batutin.android.androidvideostreaming.media;

import android.media.MediaCodecInfo;

import java.util.List;

/**
 * Created by Andrew Batutin on 8/9/13.
 */
public class CodecInfoUtilsTest extends MediaUtilsTest {

    public CodecInfoUtilsTest() {
    }

    public void testSelectAvcCodecShouldReturnCodec() throws Exception {
        MediaCodecInfo info = CodecInfoUtils.selectFirstVideoAvcCodec();
        assertNotNull(info);
    }

    public void testSelectCodecShouldReturnCodec() throws Exception {
        MediaCodecInfo info = CodecInfoUtils.selectFirstCodec(MIME_TYPE);
        assertNotNull(info);
    }

    public void testSelectCodecShouldReturnListOfCodecsInfo() throws Exception {
        List<MediaCodecInfo> infoList = CodecInfoUtils.getSupportedMediaCodecInfoList(MIME_TYPE);
        assertNotNull(infoList);
        assertTrue(infoList.size() > 0);
    }

    public void testSelectCodecShouldThroughException() throws Exception {
        try {
            MediaCodecInfo info = CodecInfoUtils.selectFirstCodec("wrong_type");
            assertNull("should not get here", info);
        } catch (IllegalArgumentException e) {
            assertNotNull(e);
        }
    }
}