public abstract class

AudioEncoderBase

extends Encoder<I, O>
java.lang.Object
   ↳ org.opencdnunion.media.streamer.encoder.Encoder<I, O>
     ↳ org.opencdnunion.media.streamer.encoder.AudioEncoderBase

Class Overview

Base class of audio encoder.

Summary

Constants
int AUDIO_CACHE_ITEM_SIZE
int AUDIO_CACHE_NUM
[Expand]
Inherited Constants
From class org.opencdnunion.media.streamer.encoder.Encoder
Fields
protected FrameBufferCache mAudioBufferCache
protected AudioEncodeConfig mAudioEncodeConfig
protected AudioEncodeConfig mOutConfig
[Expand]
Inherited Fields
From class org.opencdnunion.media.streamer.encoder.Encoder
Public Constructors
AudioEncoderBase()
Public Methods
int getEncoderType()
Implement by child class, to define what type of encoder this instance is.
Protected Methods
void doAdjustBitrate(int bitrate)
abstract int doEncode(AudioBufFrame frame)
Encode an audio frame.
int doFrameAvailable(AudioBufFrame frame)
void doFrameDropped(AudioBufFrame frame)
int doStart(Object encodeConfig)
abstract int doStart(AudioEncodeConfig config)
Start audio encoder in encoding thread.
boolean onFrameAvailable(AudioBufFrame frame)
Give child class a chance to handle onFrameAvailable
void sendEncodedPacket(ByteBuffer data, long dts, long pts, int flags)
boolean updateEncodeFormat(Object src, Object dst)
Update encode format with input frame format.
[Expand]
Inherited Methods
From class org.opencdnunion.media.streamer.encoder.Encoder
From class java.lang.Object

Constants

protected static final int AUDIO_CACHE_ITEM_SIZE

Constant Value: 8192 (0x00002000)

protected static final int AUDIO_CACHE_NUM

Constant Value: 16 (0x00000010)

Fields

protected FrameBufferCache mAudioBufferCache

protected AudioEncodeConfig mAudioEncodeConfig

protected AudioEncodeConfig mOutConfig

Public Constructors

public AudioEncoderBase ()

Public Methods

public int getEncoderType ()

Implement by child class, to define what type of encoder this instance is.

Returns
  • type as AVConst.MEDIA_TYPE_XXX

Protected Methods

protected void doAdjustBitrate (int bitrate)

protected abstract int doEncode (AudioBufFrame frame)

Encode an audio frame.

Parameters
frame audio frame to be encoded.
Returns
  • 0 on success, or error code.

protected int doFrameAvailable (AudioBufFrame frame)

protected void doFrameDropped (AudioBufFrame frame)

protected int doStart (Object encodeConfig)

protected abstract int doStart (AudioEncodeConfig config)

Start audio encoder in encoding thread.

Parameters
config Audio encode configuration.
Returns
  • 0 on success, or error code.

protected boolean onFrameAvailable (AudioBufFrame frame)

Give child class a chance to handle onFrameAvailable

Parameters
frame frame
Returns
  • true if handled by child, and Encoder would ignore this frame, false otherwise.

protected void sendEncodedPacket (ByteBuffer data, long dts, long pts, int flags)

protected boolean updateEncodeFormat (Object src, Object dst)

Update encode format with input frame format.

Parameters
src input frame format
dst encode format to be updated
Returns
  • true if success, false otherwise