0

When SB_API_VERSION is not less than SB_AUDIO_SPECIFIC_CONFIG_AS_POINTER, 'codec private' for Opus has been passed to starboard.

But I am not very sure whether the audio sample was preprocessed with 'codec delay' and 'seek preroll', is it unnecessary for audio decoder to use those?

Thanks!

Ceri Ruan
  • 13
  • 3

2 Answers2

0

The Linux reference implementation supports Opus without use of the API changes for audio_specific_config. I believe it is possible to extract all the necessary metadata from the stream itself.

David Ghandehari
  • 534
  • 3
  • 12
0

"Audio_specific_config" doesn't include the codec_delay and seek_preoll, but it can parse them from audiotrack. codec_delay: it can skip some ns samples at the begin time. seek_preroll: decoder needs skip some ns samples after seeking operation. Can you refer to the code of exoplayer and then send them through SB struct?

github.com/google/ExoPlayer/blob/release-v2/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor

case CODEC_ID_OPUS:
  mimeType = MimeTypes.AUDIO_OPUS;
  maxInputSize = OPUS_MAX_INPUT_SIZE;
  initializationData = new ArrayList<>(3);
  initializationData.add(codecPrivate);
  initializationData.add(
      ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(codecDelayNs).array());
  initializationData.add(
      ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(seekPreRollNs).array());
  break;
Mayur Shah
  • 3,344
  • 1
  • 22
  • 41