Commit 344ef707 authored by François Grisez's avatar François Grisez
Browse files

Enable Player test to manage the not supported Matroska format case

parent 9326794c
...@@ -25,11 +25,15 @@ LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *sn ...@@ -25,11 +25,15 @@ LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *sn
return obj; return obj;
} }
void file_player_destroy(LinphonePlayer *obj) { void linphone_file_player_destroy(LinphonePlayer *obj) {
ms_file_player_free((MSFilePlayer *)obj->impl); ms_file_player_free((MSFilePlayer *)obj->impl);
ms_free(obj); ms_free(obj);
} }
bool_t linphone_file_player_matroska_supported(void) {
return ms_file_player_matroska_supported();
}
static int file_player_open(LinphonePlayer *obj, const char *filename) { static int file_player_open(LinphonePlayer *obj, const char *filename) {
return ms_file_player_open((MSFilePlayer *)obj->impl, filename) ? 0 : -1; return ms_file_player_open((MSFilePlayer *)obj->impl, filename) ? 0 : -1;
} }
......
...@@ -608,7 +608,13 @@ LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_file_player(LinphoneCore *l ...@@ -608,7 +608,13 @@ LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_file_player(LinphoneCore *l
* @brief Destroy a file player * @brief Destroy a file player
* @param obj File player to destroy * @param obj File player to destroy
*/ */
LINPHONE_PUBLIC void file_player_destroy(LinphonePlayer *obj); LINPHONE_PUBLIC void linphone_file_player_destroy(LinphonePlayer *obj);
/**
* @brief Check whether Matroksa format is supported by the player
* @return TRUE if it is supported
*/
LINPHONE_PUBLIC bool_t linphone_file_player_matroska_supported(void);
/** /**
* LinphoneCallState enum represents the different state a call can reach into. * LinphoneCallState enum represents the different state a call can reach into.
......
mediastreamer2 @ 75080eb5
Subproject commit aea0153df53e7a1b16618930ecb4310983124e80 Subproject commit 75080eb55cca69c569e9b1b1cdcb4ac979f6a954
...@@ -13,10 +13,9 @@ static void eof_callback(LinphonePlayer *player, void *user_data) { ...@@ -13,10 +13,9 @@ static void eof_callback(LinphonePlayer *player, void *user_data) {
*eof = TRUE; *eof = TRUE;
} }
static void playing_test(void) { static void play_file(const char *filename, bool_t unsupported_format) {
LinphoneCoreManager *lc_manager; LinphoneCoreManager *lc_manager;
LinphonePlayer *player; LinphonePlayer *player;
const char *filename = "sounds/hello_opus_h264.mkv";
int res, time = 0; int res, time = 0;
bool_t eof = FALSE; bool_t eof = FALSE;
...@@ -28,7 +27,12 @@ static void playing_test(void) { ...@@ -28,7 +27,12 @@ static void playing_test(void) {
CU_ASSERT_PTR_NOT_NULL(player); CU_ASSERT_PTR_NOT_NULL(player);
if(player == NULL) goto fail; if(player == NULL) goto fail;
CU_ASSERT_EQUAL((res = linphone_player_open(player, filename, eof_callback, &eof)), 0); res = linphone_player_open(player, filename, eof_callback, &eof);
if(unsupported_format) {
CU_ASSERT_EQUAL(res, -1);
} else {
CU_ASSERT_EQUAL(res, 0);
}
if(res == -1) goto fail; if(res == -1) goto fail;
CU_ASSERT_EQUAL((res = linphone_player_start(player)), 0); CU_ASSERT_EQUAL((res = linphone_player_start(player)), 0);
...@@ -39,10 +43,14 @@ static void playing_test(void) { ...@@ -39,10 +43,14 @@ static void playing_test(void) {
linphone_player_close(player); linphone_player_close(player);
fail: fail:
if(player) file_player_destroy(player); if(player) linphone_file_player_destroy(player);
if(lc_manager) linphone_core_manager_destroy(lc_manager); if(lc_manager) linphone_core_manager_destroy(lc_manager);
} }
static void playing_test(void) {
play_file("sounds/hello_opus_h264.mkv", !linphone_file_player_matroska_supported());
}
test_t player_tests[] = { test_t player_tests[] = {
{ "Playing" , playing_test } { "Playing" , playing_test }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment