summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/AsyncCodecFactory.java
blob: 3295919b91873d88a92f5636357a226a0603f6aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko.media;

import android.os.Build;
import java.io.IOException;

public final class AsyncCodecFactory {
  public static AsyncCodec create(final String name) throws IOException {
    // A bug that getInputBuffer() could fail after flush() then start() wasn't fixed until MR1.
    // See:
    // https://android.googlesource.com/platform/frameworks/av/+/d9e0603a1be07dbb347c55050c7d4629ea7492e8
    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
        ? new LollipopAsyncCodec(name)
        : new JellyBeanAsyncCodec(name);
  }
}