Log::getInstance()->log("Audio", Log::DEBUG, "enter deallocatecodecsomx");
- video->LockClock();
+
Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 1");
if (cur_input_buf_omx) {
cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_EOS;
- OMX_ERRORTYPE error=OMX_EmptyThisBuffer(omx_aud_rend/*dec*/,cur_input_buf_omx);
+ OMX_ERRORTYPE error=video->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/,cur_input_buf_omx);
if (error!=OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG, "OMX_EmptyThisBuffer 6 failed %x", error);
}
}
Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 2");
+ video->LockClock();
if (omx_aud_rend/*dec*/) {
// first stop the omx elements
/* if (!video->ChangeComponentState(omx_aud_dec,OMX_StateIdle)) {
if (packet.disconti) {
firstsynched = false;
if (cur_input_buf_omx) {
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_aud_rend/*dec*/,
+ OMX_ERRORTYPE error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/,
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
lastAType = packet.type;
if (cur_input_buf_omx) {
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_aud_rend/*dec*/,
+ OMX_ERRORTYPE error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/,
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
if (packet.synched) {
if (cur_input_buf_omx) {
cur_input_buf_omx->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_aud_rend/*dec*/,
+ OMX_ERRORTYPE error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/,
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
// I doubt that this will ever happen
Log::getInstance()->log("Audio", Log::DEBUG,
"P 2 Time code %lld pts %lld", lastreftimeOMX, packet.pts);
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_aud_rend/*dec*/,
+ OMX_ERRORTYPE error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/,
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
if (cur_input_buf_omx->nFilledLen) {
Log::getInstance()->log("Audio", Log::DEBUG,
"P 3 Time code %lld pts %lld", lastreftimeOMX, packet.pts);
- error = OMX_EmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx);
+ error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
"OMX_EmptyThisBuffer 5 failed %x", error);
omx_running=false;
Log::getInstance()->log("Video", Log::DEBUG, "enter deallocatecodecsomx");
- clock_mutex.Lock();
+
if (cur_input_buf_omx) {
cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_EOS;
- OMX_ERRORTYPE error=OMX_EmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
+ OMX_ERRORTYPE error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
if (error!=OMX_ErrorNone) {
Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
}
cur_input_buf_omx=NULL;//write out old data
}
-
+ clock_mutex.Lock();
if (omx_vid_dec) {
// first stop the omx elements
if (!ChangeComponentState(omx_vid_dec,OMX_StateIdle)) {
//}
}
+OMX_ERRORTYPE VideoOMX::ProtOMXEmptyThisBuffer(OMX_HANDLETYPE handle, OMX_BUFFERHEADERTYPE* buffer)
+{
+ // protect the call to empty this buffer
+ int oldcancelstate;
+ int oldcanceltype;
+ pthread_testcancel();
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
+ pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
+ clock_mutex.Lock();
+ OMX_ERRORTYPE ret_val;
+ ret_val=OMX_EmptyThisBuffer(handle,buffer);
+ clock_mutex.Unlock();
+ pthread_setcancelstate(oldcancelstate, NULL);
+ pthread_setcanceltype(oldcanceltype, NULL);
+ pthread_testcancel();
+ return ret_val;
+}
void VideoOMX::PrepareMediaSample(const MediaPacketList& mplist,UINT samplepos)
{
if (packet.disconti) {
firstsynched=false;
if (cur_input_buf_omx) {
- OMX_ERRORTYPE error=OMX_EmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
+ OMX_ERRORTYPE error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
if (error!=OMX_ErrorNone){
Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
}
if ( packet.synched ) {
if (cur_input_buf_omx) {
cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_ENDOFFRAME;
- OMX_ERRORTYPE error=OMX_EmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
+ OMX_ERRORTYPE error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
if (error!=OMX_ErrorNone){
Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
}
*samplepos+=cancopy;
// push old buffer out
- OMX_ERRORTYPE error=OMX_EmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
+ OMX_ERRORTYPE error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
if (error!=OMX_ErrorNone){
Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
}
}
cur_input_buf_omx->nTimeStamp = 0;
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_vid_dec,
+ OMX_ERRORTYPE error = ProtOMXEmptyThisBuffer(omx_vid_dec,
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Video", Log::DEBUG,
}
cur_input_buf_omx->nTimeStamp = 0;
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_vid_dec, cur_input_buf_omx);
+ OMX_ERRORTYPE error = ProtOMXEmptyThisBuffer(omx_vid_dec, cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Video", Log::DEBUG,
"OMX_EmptyThisBuffer failed %x", error);
{
clock_mutex.Lock();
if (cur_input_buf_omx) {
- OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_vid_dec,
+ clock_mutex.Unlock();
+ OMX_ERRORTYPE error = ProtOMXEmptyThisBuffer(omx_vid_dec,
cur_input_buf_omx);
+ clock_mutex.Lock();
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Video", Log::DEBUG,
"OMX_EmptyThisBuffer failed %x", error);