- change timestamp for ulaw to 180 increments
This commit is contained in:
parent
b574413d1e
commit
7a87fc2a53
@ -2,19 +2,14 @@ package org.bigbluebutton.voiceconf.red5.media;
|
|||||||
|
|
||||||
public class AudioByteData {
|
public class AudioByteData {
|
||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
private final long timestamp;
|
|
||||||
|
public AudioByteData(byte[] data) {
|
||||||
public AudioByteData(byte[] data, long timestamp) {
|
|
||||||
this.data = new byte[data.length];
|
this.data = new byte[data.length];
|
||||||
System.arraycopy(data, 0, this.data, 0, data.length);
|
System.arraycopy(data, 0, this.data, 0, data.length);
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getData() {
|
public byte[] getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimestamp() {
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class FlashToSipAudioStream {
|
|||||||
byte[] data = SerializeUtils.ByteBufferToByteArray(buf);
|
byte[] data = SerializeUtils.ByteBufferToByteArray(buf);
|
||||||
System.out.println("RTMP data = [" + data[0] + "," + data.length + "," + packet.getTimestamp() + "]");
|
System.out.println("RTMP data = [" + data[0] + "," + data.length + "," + packet.getTimestamp() + "]");
|
||||||
|
|
||||||
AudioByteData abd = new AudioByteData(data, packet.getTimestamp());
|
AudioByteData abd = new AudioByteData(data);
|
||||||
try {
|
try {
|
||||||
audioDataQ.put(abd);
|
audioDataQ.put(abd);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -92,7 +92,7 @@ public class RtpStreamReceiver {
|
|||||||
lastPacketReceived = now;
|
lastPacketReceived = now;
|
||||||
if (rtpPacket.getSeqNum() > lastSequenceNumber) {
|
if (rtpPacket.getSeqNum() > lastSequenceNumber) {
|
||||||
lastSequenceNumber = rtpPacket.getSeqNum();
|
lastSequenceNumber = rtpPacket.getSeqNum();
|
||||||
AudioByteData audioData = new AudioByteData(rtpPacket.getPayload(), rtpPacket.getTimestamp());
|
AudioByteData audioData = new AudioByteData(rtpPacket.getPayload());
|
||||||
if (listener != null) listener.onAudioDataReceived(audioData);
|
if (listener != null) listener.onAudioDataReceived(audioData);
|
||||||
else log.debug("No listener for incoming audio packet");
|
else log.debug("No listener for incoming audio packet");
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,13 +42,16 @@ public class NellyFlashToSipTranscoderImp implements FlashToSipTranscoder {
|
|||||||
private Codec sipCodec = null; // Sip codec to be used on audio session
|
private Codec sipCodec = null; // Sip codec to be used on audio session
|
||||||
private Decoder decoder;
|
private Decoder decoder;
|
||||||
private DecoderMap decoderMap;
|
private DecoderMap decoderMap;
|
||||||
float[] tempBuffer; // Temporary buffer with received PCM audio from FlashPlayer.
|
private float[] tempBuffer; // Temporary buffer with received PCM audio from FlashPlayer.
|
||||||
int tempBufferRemaining = 0; // Floats remaining on temporary buffer.
|
private int tempBufferRemaining = 0; // Floats remaining on temporary buffer.
|
||||||
float[] encodingBuffer; // Encoding buffer used to encode to final codec format;
|
private float[] encodingBuffer; // Encoding buffer used to encode to final codec format;
|
||||||
int encodingOffset = 0; // Offset of encoding buffer.
|
private int encodingOffset = 0; // Offset of encoding buffer.
|
||||||
boolean asao_buffer_processed = false; // Indicates whether the current asao buffer was processed.
|
private boolean asao_buffer_processed = false; // Indicates whether the current asao buffer was processed.
|
||||||
boolean hasInitilializedBuffers = false; // Indicates whether the handling buffers have already been initialized.
|
private boolean hasInitilializedBuffers = false; // Indicates whether the handling buffers have already been initialized.
|
||||||
|
|
||||||
|
private long timestamp = 0;
|
||||||
|
private final static int TS_INCREMENT = 180;
|
||||||
|
|
||||||
public NellyFlashToSipTranscoderImp(Codec sipCodec) {
|
public NellyFlashToSipTranscoderImp(Codec sipCodec) {
|
||||||
this.sipCodec = sipCodec;
|
this.sipCodec = sipCodec;
|
||||||
decoder = new Decoder();
|
decoder = new Decoder();
|
||||||
@ -88,7 +91,7 @@ public class NellyFlashToSipTranscoderImp implements FlashToSipTranscoder {
|
|||||||
|
|
||||||
if (encodingOffset == sipCodec.getOutgoingDecodedFrameSize()) {
|
if (encodingOffset == sipCodec.getOutgoingDecodedFrameSize()) {
|
||||||
encodingOffset = 0;
|
encodingOffset = 0;
|
||||||
listener.handleTranscodedAudioData(transcodedAudioData, audioData.getTimestamp());
|
listener.handleTranscodedAudioData(transcodedAudioData, timestamp += TS_INCREMENT);
|
||||||
}
|
}
|
||||||
} while (!asao_buffer_processed);
|
} while (!asao_buffer_processed);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ public class NellySipToFlashTranscoderImp implements SipToFlashTranscoder {
|
|||||||
private float[] tempBuffer; // Temporary buffer with PCM audio to be sent to FlashPlayer.
|
private float[] tempBuffer; // Temporary buffer with PCM audio to be sent to FlashPlayer.
|
||||||
private int tempBufferOffset = 0;
|
private int tempBufferOffset = 0;
|
||||||
|
|
||||||
|
private long timestamp = 0;
|
||||||
|
private final static int TS_INCREMENT = 20;
|
||||||
|
|
||||||
public NellySipToFlashTranscoderImp(Codec audioCodec) {
|
public NellySipToFlashTranscoderImp(Codec audioCodec) {
|
||||||
this.audioCodec = audioCodec;
|
this.audioCodec = audioCodec;
|
||||||
@ -73,7 +75,7 @@ public class NellySipToFlashTranscoderImp implements SipToFlashTranscoder {
|
|||||||
ByteStream encodedStream = new ByteStream(NELLYMOSER_ENCODED_PACKET_SIZE);
|
ByteStream encodedStream = new ByteStream(NELLYMOSER_ENCODED_PACKET_SIZE);
|
||||||
encoderMap = CodecImpl.encode(encoderMap, tempBuffer, encodedStream.bytes);
|
encoderMap = CodecImpl.encode(encoderMap, tempBuffer, encodedStream.bytes);
|
||||||
tempBufferOffset = 0;
|
tempBufferOffset = 0;
|
||||||
listener.handleTranscodedAudioData(encodedStream.bytes, audioData.getTimestamp());
|
listener.handleTranscodedAudioData(encodedStream.bytes, timestamp += TS_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmBufferOffset == decodingBuffer.length) {
|
if (pcmBufferOffset == decodingBuffer.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user