Methods Summary |
---|
public AudioCodec | getCodec()Returns the {@link AudioCodec}, or {@code null} if it is not set.
return mCodec;
|
public int | getDtmfType()Returns the RTP payload type for dual-tone multi-frequency (DTMF) digits,
or {@code -1} if it is not enabled.
return mDtmfType;
|
public AudioGroup | getGroup()Returns the joined {@link AudioGroup}.
return mGroup;
|
public final boolean | isBusy()Returns {@code true} if the stream has already joined an
{@link AudioGroup}.
return mGroup != null;
|
public void | join(AudioGroup group)Joins an {@link AudioGroup}. Each stream can join only one group at a
time. The group can be changed by passing a different one or removed
by calling this method with {@code null}.
synchronized (this) {
if (mGroup == group) {
return;
}
if (mGroup != null) {
mGroup.remove(this);
mGroup = null;
}
if (group != null) {
group.add(this);
mGroup = group;
}
}
|
public void | setCodec(AudioCodec codec)Sets the {@link AudioCodec}.
if (isBusy()) {
throw new IllegalStateException("Busy");
}
if (codec.type == mDtmfType) {
throw new IllegalArgumentException("The type is used by DTMF");
}
mCodec = codec;
|
public void | setDtmfType(int type)Sets the RTP payload type for dual-tone multi-frequency (DTMF) digits.
The primary usage is to send digits to the remote gateway to perform
certain tasks, such as second-stage dialing. According to RFC 2833, the
RTP payload type for DTMF is assigned dynamically, so it must be in the
range of 96 and 127. One can use {@code -1} to disable DTMF and free up
the previous assigned type. This method cannot be called when the stream
already joined an {@link AudioGroup}.
if (isBusy()) {
throw new IllegalStateException("Busy");
}
if (type != -1) {
if (type < 96 || type > 127) {
throw new IllegalArgumentException("Invalid type");
}
if (mCodec != null && type == mCodec.type) {
throw new IllegalArgumentException("The type is used by codec");
}
}
mDtmfType = type;
|