Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dtmf packets need to have the same time stamp for same tone #25

Merged
merged 1 commit into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

package net.sourceforge.peers.media;

import java.util.ArrayList;
import java.util.List;

import net.sourceforge.peers.rtp.RFC4733;
import net.sourceforge.peers.rtp.RtpPacket;

import java.util.ArrayList;
import java.util.List;

public class DtmfFactory {

public List<RtpPacket> createDtmfPackets(char digit) {
Expand Down Expand Up @@ -61,6 +61,7 @@ public List<RtpPacket> createDtmfPackets(char digit) {
data[2] = 1;
data[3] = 64;
rtpPacket.setData(data);
rtpPacket.setIncrementTimeStamp(false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rtpPacket.setMarker(false);
rtpPacket.setPayloadType(RFC4733.PAYLOAD_TYPE_TELEPHONE_EVENT);
packets.add(rtpPacket);
Expand All @@ -71,6 +72,7 @@ public List<RtpPacket> createDtmfPackets(char digit) {
data[2] = 1;
data[3] = -32;
rtpPacket.setData(data);
rtpPacket.setIncrementTimeStamp(false);
rtpPacket.setMarker(false);
rtpPacket.setPayloadType(RFC4733.PAYLOAD_TYPE_TELEPHONE_EVENT);
packets.add(rtpPacket);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void run() {
RtpPacket pushedPacket = pushedPackets.remove(0);
rtpPacket.setMarker(pushedPacket.isMarker());
rtpPacket.setPayloadType(pushedPacket.getPayloadType());
rtpPacket.setIncrementTimeStamp(pushedPacket.isIncrementTimeStamp());
byte[] data = pushedPacket.getData();
rtpPacket.setData(data);
} else {
Expand All @@ -145,7 +146,9 @@ public void run() {
}

rtpPacket.setSequenceNumber(sequenceNumber++);
timestamp += buf_size;
if (rtpPacket.isIncrementTimeStamp()) {
timestamp += buf_size;
}
rtpPacket.setTimestamp(timestamp);
if (firstTime) {
rtpSession.send(rtpPacket);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class RtpPacket {
private long ssrc;
private long[] csrcList;
private byte[] data;
private boolean incrementTimeStamp = true;

public int getVersion() {
return version;
Expand Down Expand Up @@ -121,4 +122,11 @@ public void setData(byte[] data) {
this.data = data;
}

public boolean isIncrementTimeStamp() {
return incrementTimeStamp;
}

public void setIncrementTimeStamp(boolean incrementTimeStamp) {
this.incrementTimeStamp = incrementTimeStamp;
}
}