Android ndk 我怎样才能摧毁playerObj?
我正在尝试创建引擎和输出组合:Android ndk 我怎样才能摧毁playerObj?,android-ndk,opensl,Android Ndk,Opensl,我正在尝试创建引擎和输出组合: // create engine this->res = slCreateEngine(&this->engineObject, 0, NULL, 0, NULL, NULL); if (SL_RESULT_SUCCESS != this->res) { LOGI("Can't Create Engine."); this->Free(); return; } this->res = (*this-&g
// create engine
this->res = slCreateEngine(&this->engineObject, 0, NULL, 0, NULL, NULL);
if (SL_RESULT_SUCCESS != this->res)
{
LOGI("Can't Create Engine.");
this->Free();
return;
}
this->res = (*this->engineObject)->Realize(this->engineObject, SL_BOOLEAN_FALSE);
if (SL_RESULT_SUCCESS != this->res)
{
LOGI("Can't Realize Engine.");
this->Free();
return;
}
this->res = (*this->engineObject)->GetInterface(this->engineObject, SL_IID_ENGINE, &this->engineEngine);
if (SL_RESULT_SUCCESS != this->res)
{
LOGI("Can't GetInterface Engine.");
this->Free();
return;
}
// create output mix
this->res = (*this->engineEngine)->CreateOutputMix(this->engineEngine, &this->outputmixObject, 0, NULL, NULL);
if (SL_RESULT_SUCCESS != this->res)
{
LOGI("Can't Create Output Mix.");
this->Free();
return;
}
this->res = (*this->outputmixObject)->Realize(this->outputmixObject, SL_BOOLEAN_FALSE);
if (SL_RESULT_SUCCESS != this->res)
{
LOGI("Can't Realize Output Mix.");
this->Free();
return;
}
这是成功的
从IceCast开始播放mp3流
(例如“”):
filename=“”
LogCat开始打印错误消息…:
E/libOpenSLES(16432):媒体缓冲更新-491520000%<0
E/libOpenSLES(16432):媒体缓冲更新-655360000%<0
E/libOpenSLES(16432):媒体缓冲更新-819200000%<0
但是小溪在玩!
好吧,我试着停止玩:
this->res = (*this->playerInterface)->SetPlayState(this->playerInterface, SL_PLAYSTATE_STOPPED);
if (SL_RESULT_SUCCESS != this->res)
LOGI("Can't Set Play State \"SL_PLAYSTATE_STOPPED\".");
好的!游戏确实停止了,但玩家继续下载流。
所以我试着摧毁PlayerObj:
(*this->player)->Destroy(this->player);
LogCat打印错误消息:
A//system/bin/app_进程(16690):检测到堆栈损坏:中止
和应用程序进程终止。
怎么了?在“设置循环”之后,我开始播放:
this->res=(*this->playerInterface)->设置播放状态(this->playerInterface,SL_playerState_playing)代码>问题已解决,错误在不同的位置!
(*this->player)->Destroy(this->player);