shadows/framework/src/main/java/org/robolectric/shadows/ShadowMediaCodec.java
@Implementation(minSdk = LOLLIPOP)
  protected void native_start() {
    // Currently only support async-mode.
    if (callback == null) {
      return;
    }

    // Report the format as changed, to simulate adding codec specific info before making input
    // buffers available.
    HashMap<String, Object> format = new HashMap<>();
    format.put("csd-0", ByteBuffer.wrap(new byte[]{0x13, 0x10}));
    format.put("csd-1", ByteBuffer.wrap(new byte[0]));
    postFakeNativeEvent(EVENT_CALLBACK, CB_OUTPUT_FORMAT_CHANGE, 0, format);

    // Reset state.
    reachedEos = false;

    makeInputBufferAvailable(0);
  }
@Implementation(minSdk = LOLLIPOP)
  protected void native_start() {
    // Currently only support async-mode.
    if (callback == null) {
      return;
    }

    // Report the format as changed, to simulate adding codec specific info before making input
    // buffers available.
    HashMap<String, Object> format = new HashMap<>();
    format.put("csd-0", ByteBuffer.wrap(new byte[]{0x13, 0x10}));
    format.put("csd-1", ByteBuffer.wrap(new byte[0]));
    postFakeNativeEvent(EVENT_CALLBACK, CB_OUTPUT_FORMAT_CHANGE, 0, format);

    // Reset state.
    reachedEos = false;

    makeInputBufferAvailable(0);
  }
Starts the async encoding process, by first reporting a format change event, and then
presenting an input buffer to the callback.