From 324feaf10393e89bf0b975d738a176e15ccbfdf5 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Tue, 21 Jun 2016 18:56:24 +0900 Subject: [PATCH] [ITC][player][Non-ACR][Fix ITc_player_push_media_stream_p error on common profile] Change-Id: I1c4c5b3659b82c2d2b3f7c133a86337507fd1f08 Signed-off-by: Gilbok Lee --- packaging/itc/native-player-itc.spec | 8 ---- src/itc/player/ITs-player-common.h | 2 +- src/itc/player/ITs-player.c | 85 ++++++++++++++++++------------------ src/utc/player/utc-media-player-es.c | 2 +- 4 files changed, 45 insertions(+), 52 deletions(-) diff --git a/packaging/itc/native-player-itc.spec b/packaging/itc/native-player-itc.spec index a547df5..407b50c 100755 --- a/packaging/itc/native-player-itc.spec +++ b/packaging/itc/native-player-itc.spec @@ -72,15 +72,7 @@ cp src/itc/player/short.mp3 %{buildroot}%{APP_PATH}%{name}/data/short.mp3 cp src/itc/player/file.mp4 %{buildroot}%{APP_PATH}%{name}/data/file.mp4 cp src/itc/player/sub.srt %{buildroot}%{APP_PATH}%{name}/data/sub.srt cp src/itc/player/v.mp4 %{buildroot}%{APP_PATH}%{name}/data/v.mp4 - -%if %{?DEVICE_BUILD_TYPE_MOBILE:1}0 -cp src/itc/player/Simpsons.h264 %{buildroot}%{APP_PATH}%{name}/data/Simpsons.h264 -%endif - -%if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0 cp src/itc/player/Simpsons.h264 %{buildroot}%{APP_PATH}%{name}/data/Simpsons.h264 -%endif - cp src/itc/player/AWB_header_change_AMR.amr %{buildroot}%{APP_PATH}%{name}/data/AWB_header_change_AMR.amr mkdir -p %{buildroot}/usr/share/packages/ diff --git a/src/itc/player/ITs-player-common.h b/src/itc/player/ITs-player-common.h index 34bc85c..94bdca3 100755 --- a/src/itc/player/ITs-player-common.h +++ b/src/itc/player/ITs-player-common.h @@ -37,7 +37,7 @@ #define TIMEOUT 20000 #define SLEEP_TIME 12 #define API_NAMESPACE "PLAYER_ITC" -#define ES_NUMBER_OF_FEED 1000 +#define ES_NUMBER_OF_FEED 100 #define ES_DEFAULT_VIDEO_PTS_OFFSET 20000000 #define MEDIA_PATH_CORRUPT_FILE "AWB_header_change_AMR.amr" #define MEDIA_PATH_VIDEO2 "v.mp4" diff --git a/src/itc/player/ITs-player.c b/src/itc/player/ITs-player.c index f54742c..c704a8d 100755 --- a/src/itc/player/ITs-player.c +++ b/src/itc/player/ITs-player.c @@ -360,12 +360,13 @@ static void PlayerMediaStreamBufferStatusCallback(player_media_stream_buffer_sta * @parameter FILE *fd, unsigned char* nal * @return void */ +unsigned char sps[100] = {'\0'}; +unsigned char pps[100] = {'\0'}; +int sps_len = 0, pps_len = 0; + unsigned int ByteStreamToNalUnit(FILE *fd, unsigned char* nal) { - unsigned char sps[100] = {'\0'}; - unsigned char pps[100] = {'\0'}; unsigned char tmp_buf[1000000] = {'\0'}; - int sps_len = 0, pps_len = 0; int nal_length = 0; size_t result; int read_size = 1; @@ -672,12 +673,7 @@ static void SeekCompletedCB(void *user_data) */ static void PlayerPreparedCB(void *user_data) { - int nRet = player_set_play_position(g_player, 2, TRUE, SeekCompletedCB, NULL); - if ( PLAYER_ERROR_NONE != nRet ) - { - FPRINTF("[Line : %d][%s] player seek is failed\\n", __LINE__, API_NAMESPACE); - } - nRet = player_start(g_player); + int nRet = player_start(g_player); if ( PLAYER_ERROR_NONE != nRet ) { FPRINTF("[Line : %d][%s] player_start is failed\\n", __LINE__, API_NAMESPACE); @@ -837,7 +833,7 @@ int ITc_player_capture_video_p(void) int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, g_pEvasObject); #endif //MOBILE //End MOBILE or TV #if defined( WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE - int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); + int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); #endif //WEARABLE //End WEARABLE PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); @@ -1091,11 +1087,11 @@ int ITc_player_get_progressive_download_status_p(void) } #if defined(MOBILE) || defined(TV) //Starts MOBILE or COMMON_IOT or TV int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, g_pEvasObject); - #endif //End MOBILE or COMMON_IOT or TV + #endif //End MOBILE or COMMON_IOT or TV #if defined(WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); #endif //WEARABLE //End WEARABLE - + PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); char pstrValue[CONFIG_VALUE_LEN_MAX] = {0,}; @@ -1201,7 +1197,7 @@ int ITc_player_get_streaming_download_progress_p(void) #endif //End MOBILE or COMMON_IOT or TV #if defined(WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); - #endif //WEARABLE //End WEARABLE + #endif //WEARABLE //End WEARABLE PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); char pstrValue[CONFIG_VALUE_LEN_MAX] = {0,}; @@ -1298,15 +1294,15 @@ int ITc_player_set_unset_progressive_download_message_cb_p(void) return 1; } - + #if defined(MOBILE) || defined(TV) //Starts MOBILE or COMMON_IOT or TV int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, g_pEvasObject); #endif //End MOBILE or COMMON_IOT or TV #if defined(WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); - #endif //WEARABLE //End WEARABLE + #endif //WEARABLE //End WEARABLE PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); - + char pstrValue[CONFIG_VALUE_LEN_MAX] = {0,}; if ( true == GetValueFromConfigFile("PLAYER_DOWNLOAD_PROGRESS_URL", pstrValue, API_NAMESPACE) ) @@ -1722,9 +1718,9 @@ int ITc_player_pause_p(void) #endif //End MOBILE or COMMON_IOT or TV #if defined(WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); - #endif //WEARABLE //End WEARABLE + #endif //WEARABLE //End WEARABLE PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); - + sleep(2); @@ -1935,13 +1931,13 @@ int ITc_player_set_unset_completed_cb_p(void) int nRet = player_set_completed_cb(g_player, PlayerCompletedCallback, NULL); PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_completed_cb", PlayerGetError(nRet)); - + #if defined(MOBILE) || defined(TV) //Starts MOBILE or COMMON_IOT or TV nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, GET_DISPLAY(g_pEvasObject)); #endif //End MOBILE or COMMON_IOT or TV #if defined(WEARABLE) || defined(COMMON_IOT)//Starts WEARABLE - nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, GET_DISPLAY(g_pEvasWindow)); - #endif //WEARABLE //End WEARABLE + nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, GET_DISPLAY(g_pEvasWindow)); + #endif //WEARABLE //End WEARABLE PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); if ( InitializePlayerHandler(true, 1) == false ) @@ -2114,8 +2110,8 @@ int ITc_player_set_unset_media_packet_video_frame_decoded_cb_p(void) nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_NONE, GET_DISPLAY(g_pEvasObject)); #endif //End MOBILE or COMMON_IOT #ifdef WEARABLE //Starts WEARABLE - nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_NONE, GET_DISPLAY(g_pEvasWindow)); - #endif //WEARABLE //End WEARABLE + nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_NONE, GET_DISPLAY(g_pEvasWindow)); + #endif //WEARABLE //End WEARABLE PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); if ( InitializePlayerHandler(true, 1) == false ) @@ -2154,7 +2150,7 @@ int ITc_player_set_unset_media_packet_video_frame_decoded_cb_p(void) player_unprepare(g_player); return 1; } - + //player_stop(g_player); nRet = player_get_state(g_player,&state); @@ -2208,7 +2204,7 @@ int ITc_player_prepare_async_p(void) PRINT_API_ERROR_IN_LOOP_MSG_SINGLE(InitializePlayerHandler); return 1; } - + #if defined(MOBILE) || defined(TV) //Starts MOBILE or COMMON_IOT or TV int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, g_pEvasObject); #endif //End MOBILE or TV @@ -2319,23 +2315,23 @@ int ITc_player_set_get_play_position_p(void) START_TEST;s media_format_h hMediaFormat = NULL; media_packet_h hMediaPacket = NULL; - + guint8 *buff_ptr = NULL; void *src = NULL; guint64 pts = 0L; uint64_t nSize = 1024; - + //get media format int nRet = media_format_create(&hMediaFormat); PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_create", MediaFormatGetError(nRet)); - + //set audio format nRet = media_format_set_audio_mime(hMediaFormat, MEDIA_FORMAT_AAC); PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_mime", MediaFormatGetError(nRet), media_format_unref(hMediaFormat)); - + nRet = media_format_set_audio_channel(hMediaFormat, 2); PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_channel", MediaFormatGetError(nRet), media_format_unref(hMediaFormat)); - + nRet = media_format_set_audio_samplerate(hMediaFormat, 48000); PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_samplerate", MediaFormatGetError(nRet), media_format_unref(hMediaFormat)); @@ -2357,13 +2353,13 @@ int ITc_player_set_get_play_position_p(void) //Target API nRet = player_push_media_stream(g_player, hMediaPacket); PRINT_RESULT_CLEANUP(PLAYER_ERROR_NONE, nRet, "player_set_media_stream_video_info", PlayerGetError(nRet), g_free(buff_ptr);media_format_unref(hMediaFormat)); - + if ( buff_ptr ) { g_free(buff_ptr); buff_ptr = NULL; } - + nRet = media_format_unref(hMediaFormat); PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_unref", MediaFormatGetError(nRet)); @@ -2403,6 +2399,11 @@ int ITc_player_push_media_stream_p(void) return 1; } file_src = fopen(pPath, "r"); + if (!file_src) + { + FPRINTF("[Line : %d][%s] Fail to open file\\n", __LINE__, API_NAMESPACE); + return 1; + } int nRet = player_set_uri(g_player, ES_FEEDING_PATH); PRINT_RESULT_CLEANUP(PLAYER_ERROR_NONE, nRet, "player_set_uri", PlayerGetError(nRet), fclose(file_src)); @@ -2431,7 +2432,7 @@ int ITc_player_push_media_stream_p(void) nRet = player_set_media_stream_buffer_status_cb(g_player, PLAYER_STREAM_TYPE_VIDEO, PlayerMediaStreamBufferStatusCallback, NULL); PRINT_RESULT_CLEANUP(PLAYER_ERROR_NONE, nRet, "player_set_media_stream_buffer_status_cb", PlayerGetError(nRet), media_format_unref(g_hMediaFormat); fclose(file_src)); - nRet = player_set_media_stream_buffer_max_size(g_player, PLAYER_STREAM_TYPE_VIDEO, 10000); + nRet = player_set_media_stream_buffer_max_size(g_player, PLAYER_STREAM_TYPE_VIDEO, 3*1024*1024); PRINT_RESULT_CLEANUP(PLAYER_ERROR_NONE, nRet, "player_set_media_stream_buffer_max_size", PlayerGetError(nRet), media_format_unref(g_hMediaFormat); fclose(file_src)); nRet = player_set_media_stream_seek_cb(g_player, PLAYER_STREAM_TYPE_VIDEO, PlayerMediaStreamSeekCallBack, NULL); @@ -2525,7 +2526,7 @@ int ITc_player_set_unset_video_stream_changed_cb_p(void) #if defined(MOBILE) //Starts MOBILE or COMMON_IOT nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, g_pEvasObject); - #endif //End MOBILE + #endif //End MOBILE #if defined(WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); #endif //WEARABLE //End WEARABLE @@ -2870,7 +2871,7 @@ int ITc_player_get_track_count_p(void) #if defined(WEARABLE) || defined(COMMON_IOT) //Starts WEARABLE int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_OVERLAY, g_pEvasWindow); #endif //WEARABLE //End WEARABLE - + PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_display", PlayerGetError(nRet)); sleep(2); @@ -3015,7 +3016,7 @@ int ITc_player_get_track_language_code_p(void) player_state_e state; int nCount = 0, nIndex = 0; char *pszLangCode = NULL; - + #if defined(MOBILE) || defined(TV) int nRet = player_set_display(g_player, PLAYER_DISPLAY_TYPE_EVAS, g_pEvasObject); #endif //End MOBILE or COMMON_IOT or TV @@ -3247,21 +3248,21 @@ int ITc_player_set_unset_media_stream_buffer_status_cb_p(void) * @type auto * @description Registers a callback function to be invoked when the audio input handle is interrupted or the interrupt is completed. * @scenario Registers a callback function \n - UnRegisters a callback function -* @apicovered player_set_interrupted_cb, player_unset_interrupted_cb + UnRegisters a callback function +* @apicovered player_set_interrupted_cb, player_unset_interrupted_cb * @passcase When player_set_interrupted_cb is successful. * @failcase If target api player_set_interrupted_cb fails or any precondition api fails. * @precondition Audio handle must be created * @postcondition Audio handle must be released -* +* */ int ITc_player_in_set_unset_interrupted_cb_p(void) -{ +{ START_TEST; - + int nRet = player_set_interrupted_cb(g_player, PlayerInterruptCb, NULL); PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_set_interrupted_cb", PlayerGetError(nRet)); - + nRet = player_unset_interrupted_cb(g_player); PRINT_RESULT(PLAYER_ERROR_NONE, nRet, "player_unset_interrupted_cb", PlayerGetError(nRet)); diff --git a/src/utc/player/utc-media-player-es.c b/src/utc/player/utc-media-player-es.c index 6fe2e2e..33d4154 100755 --- a/src/utc/player/utc-media-player-es.c +++ b/src/utc/player/utc-media-player-es.c @@ -28,7 +28,7 @@ //& set: PlayerMediaEs #define ES_FEEDING_PATH "es_buff://pull_mode" #define ES_DEFAULT_VIDEO_PTS_OFFSET 20000000 -#define ES_NUMBER_OF_FEED 1000 +#define ES_NUMBER_OF_FEED 100 #define ES_BUFFER_MAX_SIZE (3*1024*1024) #define DRC_URI "http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/RedBullPlayStreets/redbull_4s/RedBullPlayStreets_4s_isoffmain_DIS_23009_1_v_2_1c2_2011_08_30.mpd" static char* media="Simpsons.h264"; -- 2.7.4