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