Skip to content

Commit

Permalink
Test-case for HTTPS streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
bear101 committed Oct 3, 2018
1 parent 911a299 commit bf914d8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Library/TeamTalkJNI/Makefile
Expand Up @@ -77,11 +77,11 @@ help:
@echo " OUTPUTDEVICEID"
@echo " 1978 = virtual sound device, 0 = default audio device."
@echo " PROEDITION"
@echo " 0 = Standard Edition (TeamTalk5-jni), 1 = Professional Edition (TeamTalk5Pro-jni)"
@echo " 0 = Standard Edition (TeamTalk5-jni), 1 = Professional Edition (TeamTalk5Pro-jni). Default is 0."
@echo " ENCRYPTED"
@echo " 0 = Non-encrypted, 1 = Encrypted"
@echo " 0 = Non-encrypted, 1 = Encrypted. Default is 0."
@echo " VIDEODEVICEID"
@echo " None = Disable video capure unit tests"
@echo " None = Disable video capure unit tests."
@echo " SERVERIP"
@echo " Client should connect to this hostname/IP-address. Default is 127.0.0.1"
@echo " SERVERBINDIP"
Expand Down
37 changes: 37 additions & 0 deletions Library/TeamTalkJNI/test/dk/bearware/TeamTalkTestCase.java
Expand Up @@ -508,6 +508,43 @@ public void test_MediaStreaming() {
assertTrue("Stopped", ttclient.stopStreamingMediaFileToChannel());
}

public void test_MediaStreaming_https() {

TeamTalkBase ttclient = newClientInstance();

final String USERNAME = "tt_test", PASSWORD = "tt_test", NICKNAME = "jUnit - " + getCurrentMethod();
int USERRIGHTS = UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_AUDIO | UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_VIDEO;
makeUserAccount(NICKNAME, USERNAME, PASSWORD, USERRIGHTS);

TTMessage msg = new TTMessage();

initSound(ttclient);
connect(ttclient);
login(ttclient, NICKNAME, USERNAME, PASSWORD);
joinRoot(ttclient);

MediaFileInfo mfi = new MediaFileInfo();
assertTrue("Get media file info", ttclient.getMediaFileInfo(HTTPS_MEDIAFILE, mfi));

VideoCodec vidcodec = new VideoCodec();

assertTrue("Start", ttclient.startStreamingMediaFileToChannel(HTTPS_MEDIAFILE, vidcodec));

assertTrue("Wait stream event", waitForEvent(ttclient, ClientEvent.CLIENTEVENT_STREAM_MEDIAFILE, DEF_WAIT, msg));

assertEquals("Begin stream", msg.mediafileinfo.nStatus, MediaFileStatus.MFS_STARTED);
assertEquals("Filename match", msg.mediafileinfo.szFileName, mfi.szFileName);
assertEquals("Found duration", msg.mediafileinfo.uDurationMSec, mfi.uDurationMSec);

assertTrue("Wait USER_STATECHANGE", waitForEvent(ttclient, ClientEvent.CLIENTEVENT_USER_STATECHANGE, DEF_WAIT, msg));

waitForEvent(ttclient, ClientEvent.CLIENTEVENT_NONE, 1000);

assertTrue("Stopped", ttclient.stopStreamingMediaFileToChannel());
}



public void test_MediaStorage_WaveOutput() {

final String USERNAME = "tt_test", PASSWORD = "tt_test", NICKNAME = "jUnit - " + getCurrentMethod();
Expand Down
Expand Up @@ -50,6 +50,7 @@ public class TeamTalkTestCaseBase extends TestCase {
public static final String MUXEDMEDIAFILE_OPUS = "muxwavefile_opus.ogg";
public static final String MEDIAFILE_AUDIO = "music.wav";
public static final String MEDIAFILE = "video.avi";
public static final String HTTPS_MEDIAFILE = "https://www.bearware.dk/test/giana.wma";
public Vector<TeamTalkBase> ttclients = new Vector<TeamTalkBase>();

protected void setUp() throws Exception {
Expand Down Expand Up @@ -254,9 +255,9 @@ protected static boolean waitForEvent(TeamTalkBase ttclient, int nClientEvent,
int waittimeout, TTMessage msg, ServerInterleave interleave) {
long start = System.currentTimeMillis();
TTMessage tmp = new TTMessage();

boolean gotmsg;
do {
ttclient.getMessage(tmp, 0);
gotmsg = ttclient.getMessage(tmp, 0);

interleave.interleave();

Expand All @@ -269,7 +270,7 @@ protected static boolean waitForEvent(TeamTalkBase ttclient, int nClientEvent,
if(System.currentTimeMillis() - start >= waittimeout)
break;
}
while (tmp.nClientEvent != nClientEvent);
while (!gotmsg || tmp.nClientEvent != nClientEvent);

// while (ttclient.getMessage(tmp, 0) && tmp.nClientEvent != nClientEvent)
// {
Expand Down

0 comments on commit bf914d8

Please sign in to comment.