public class

AVAdapter

extends Object
java.lang.Object
   ↳ org.opencdnunion.media.streamer.avAdaptor.AVAdapter

Class Overview

network adaptor and Audio video interleave module

Summary

Nested Classes
interface AVAdapter.AdapterListener  
class AVAdapter.BwEstConfig  
Constants
int BW_EST_STRATEGY_NORMAL
int CMD_RELEASE
int CMD_START
int CMD_STOP
int CMD_WRITE_FRAME
int ERROR_AV_ASYNC_ERROR
int INFO_AUDIO_HEADER_GOT
int INFO_EST_BW_DROP
int INFO_EST_BW_RAISE
int INFO_PACKET_SEND_SLOW
int INFO_STARTED
int INFO_STOPPED
int INFO_VIDEO_HEADER_GOT
long INVALID_TS
int STATE_IDLE
int STATE_PROCESSING
int STATE_STARTING
int STATE_STOPPING
Fields
protected int mAFrameDropped
protected Handler mAdapterHandler
protected AVAdapter.AdapterListener mAdapterListener
protected HandlerThread mAdapterThread
protected AVAdapterWrapper mAdapterWrapper
protected boolean mAudioTrackAdded
protected long mInitDts
protected boolean mIsAudioOnly
protected boolean mIsProcessing
protected boolean mIsVideoOnly
protected long mLastAudioDts
protected long mLastVideoDts
protected final Handler mMainHandler
protected AtomicInteger mState
protected int mVFrameDroppedInner
protected int mVFrameDroppedUpper
protected boolean mVideoKeyFrameGot
protected long mVideoPts
protected boolean mVideoTrackAdded
Public Constructors
AVAdapter(String name)
Public Methods
AVAdapter.AdapterListener getAdapterListener()
SinkPin<AudioPacket> getAudioSink()
boolean getAutoWork()
Get if publisher start/stop by input frames.
int getDroppedVideoFrames()
Get dropped video frame number util now.
SrcPin<AVPacketBase> getSrcPin()
boolean getUseSyncMode()
Get if writing frames in sync mode.
SinkPin<ImgPacket> getVideoSink()
boolean isAudioExtraGot()
boolean isAudioOnly()
boolean isProcessing()
boolean isVideoExtraGot()
boolean isVideoOnly()
void release()
void setAVAdapterListener(AVAdapter.AdapterListener listener)
void setAudioExtra(AVPacketBase audioExtra)
void setAudioOnly(boolean audioOnly)
Set if this stream is audio only.
void setAutoWork(boolean autoWork)
Set if publisher start/stop by input frames.
void setBwEstConfig(AVAdapter.BwEstConfig config)
void setUseSyncMode(boolean useSyncMode)
Set if writing frames in sync mode.
void setVideoExtra(AVPacketBase videoExtra)
void setVideoOnly(boolean videoOnly)
Set if this stream is video only.
boolean start()
void stop()
int writeFrame(int type, ByteBuffer data, long dts, long pts, int flags)
Protected Methods
void doRelease()
int doStart()
void doStop()
int doWriteFrame(Object object)
void handleAVFrame(AVPacketBase packet)
void postError(int err, long msg)
void postError(int err)
void postInfo(int type, long msg)
void postInfo(int type)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int BW_EST_STRATEGY_NORMAL

Constant Value: 0 (0x00000000)

protected static final int CMD_RELEASE

Constant Value: 4 (0x00000004)

protected static final int CMD_START

Constant Value: 1 (0x00000001)

protected static final int CMD_STOP

Constant Value: 2 (0x00000002)

protected static final int CMD_WRITE_FRAME

Constant Value: 3 (0x00000003)

public static final int ERROR_AV_ASYNC_ERROR

Constant Value: -2004 (0xfffff82c)

public static final int INFO_AUDIO_HEADER_GOT

Constant Value: 2 (0x00000002)

public static final int INFO_EST_BW_DROP

Constant Value: 102 (0x00000066)

public static final int INFO_EST_BW_RAISE

Constant Value: 101 (0x00000065)

public static final int INFO_PACKET_SEND_SLOW

Constant Value: 100 (0x00000064)

public static final int INFO_STARTED

Constant Value: 1 (0x00000001)

public static final int INFO_STOPPED

Constant Value: 4 (0x00000004)

public static final int INFO_VIDEO_HEADER_GOT

Constant Value: 3 (0x00000003)

protected static final long INVALID_TS

Constant Value: -9223372036854775808 (0x8000000000000000)

public static final int STATE_IDLE

Constant Value: 0 (0x00000000)

public static final int STATE_PROCESSING

Constant Value: 2 (0x00000002)

public static final int STATE_STARTING

Constant Value: 1 (0x00000001)

public static final int STATE_STOPPING

Constant Value: 3 (0x00000003)

Fields

protected int mAFrameDropped

protected Handler mAdapterHandler

protected AVAdapter.AdapterListener mAdapterListener

protected HandlerThread mAdapterThread

protected AVAdapterWrapper mAdapterWrapper

protected boolean mAudioTrackAdded

protected long mInitDts

protected boolean mIsAudioOnly

protected boolean mIsProcessing

protected boolean mIsVideoOnly

protected long mLastAudioDts

protected long mLastVideoDts

protected final Handler mMainHandler

protected AtomicInteger mState

protected int mVFrameDroppedInner

protected int mVFrameDroppedUpper

protected boolean mVideoKeyFrameGot

protected long mVideoPts

protected boolean mVideoTrackAdded

Public Constructors

public AVAdapter (String name)

Public Methods

public AVAdapter.AdapterListener getAdapterListener ()

public SinkPin<AudioPacket> getAudioSink ()

public boolean getAutoWork ()

Get if publisher start/stop by input frames.

Returns
  • is auto work

public int getDroppedVideoFrames ()

Get dropped video frame number util now. Valid on STATE_PROCESSING.

Returns
  • dropped video frame number.

public SrcPin<AVPacketBase> getSrcPin ()

public boolean getUseSyncMode ()

Get if writing frames in sync mode.

Returns
  • sync mode

public SinkPin<ImgPacket> getVideoSink ()

public boolean isAudioExtraGot ()

public boolean isAudioOnly ()

public boolean isProcessing ()

public boolean isVideoExtraGot ()

public boolean isVideoOnly ()

public void release ()

public void setAVAdapterListener (AVAdapter.AdapterListener listener)

public void setAudioExtra (AVPacketBase audioExtra)

public void setAudioOnly (boolean audioOnly)

Set if this stream is audio only.

Parameters
audioOnly true if stream is audio only

public void setAutoWork (boolean autoWork)

Set if publisher start/stop by input frames.

For example, onFormatChanged would start publishing if publisher not started, and packet with FLAG_END_OF_STREAM would stop publishing.

Parameters
autoWork true to enable, false to disable

public void setBwEstConfig (AVAdapter.BwEstConfig config)

public void setUseSyncMode (boolean useSyncMode)

Set if writing frames in sync mode.

Parameters
useSyncMode true in sync mode, false in async mode.

public void setVideoExtra (AVPacketBase videoExtra)

public void setVideoOnly (boolean videoOnly)

Set if this stream is video only.

Parameters
videoOnly true if stream is video only

public boolean start ()

public void stop ()

public int writeFrame (int type, ByteBuffer data, long dts, long pts, int flags)

Protected Methods

protected void doRelease ()

protected int doStart ()

protected void doStop ()

protected int doWriteFrame (Object object)

protected void handleAVFrame (AVPacketBase packet)

protected void postError (int err, long msg)

protected void postError (int err)

protected void postInfo (int type, long msg)

protected void postInfo (int type)