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);
if (error!=OMX_ErrorNone) {
- Log::getInstance()->log("Audio", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
+ Log::getInstance()->log("Audio", Log::DEBUG, "OMX_EmptyThisBuffer 6 failed %x", error);
}
cur_input_buf_omx=NULL;//write out old data
}
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 2");
if (omx_aud_rend/*dec*/) {
// first stop the omx elements
/* if (!video->ChangeComponentState(omx_aud_dec,OMX_StateIdle)) {
Log::getInstance()->log("Audio", Log::DEBUG, "aud_dec ChangeComponentState");
}*/
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 3");
video->UnlockClock();
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 4");
video->idleClock();
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 5");
video->LockClock();
if (!video->ChangeComponentState(omx_aud_rend,OMX_StateIdle)) {
Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Flush rend clock failed %x", error);
}
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 6");
if (!video->CommandFinished(omx_clock,OMX_CommandFlush,omx_clock_output_port) ||
!video->CommandFinished(omx_aud_rend,OMX_CommandFlush,omx_rend_clock_port)) {
}
DestroyInputBufsOMX(); //We have to make sure that no buffers are in use
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 6a");
DeinitDecoderLibAV();
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 7");
//todo flushing
if (!video->DisablePort(omx_aud_rend,omx_rend_input_port,true)) {
Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error);
}
+ Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 8");
//error=OMX_FreeHandle(omx_aud_dec);
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
- "OMX_EmptyThisBuffer failed %x", error);
+ "OMX_EmptyThisBuffer 1 failed %x", error);
}
cur_input_buf_omx = NULL;
}
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
- "OMX_EmptyThisBuffer failed %x", error);
+ "OMX_EmptyThisBuffer 2 failed %x", error);
}
cur_input_buf_omx = NULL;
}
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
- "OMX_EmptyThisBuffer failed %x", error);
+ "OMX_EmptyThisBuffer 3 failed %x", error);
}
//FrameWaitforDisplay(lastreftimeOMX);
vw->AdjustAudioPTS(correctAudioLatency(lastreftimeOMX,cur_input_buf_omx->nFilledLen/(2*2),48000));
while (haveToCopy> 0 && errcount<2) {
//Log::getInstance()->log("Audio", Log::DEBUG,"libav in %d %d",framesize,current_context->frame_size);
+ //Log::getInstance()->log("Audio", Log::DEBUG, "libav in %d %d",
+ // framesize, current_context->frame_size);
+ int oldcancelstate;
+ int oldcanceltype;
+ pthread_testcancel();
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
+ pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
libav_mutex.Lock();
- if (!omx_running || !mp23codec_context_libav || !ac3codec_context_libav) {
+ if (!omx_running || !mp23codec_context_libav
+ || !ac3codec_context_libav) {
libav_mutex.Unlock();
- return 0;
+ return *samplepos;
}
- Log::getInstance()->log("Audio", Log::DEBUG,"libav in %d %d",framesize,current_context->frame_size);
+ libav_mutex.Unlock();
+ // Log::getInstance()->log("Audio", Log::DEBUG,"libav out");
len = avcodec_decode_audio4(current_context, decode_frame_libav,
&gotta, &incoming_paket_libav);
- Log::getInstance()->log("Audio", Log::DEBUG,"libav out");
+ //Log::getInstance()->log("Audio", Log::DEBUG, "libav out1");
+ pthread_setcancelstate(oldcancelstate, NULL);
+ pthread_setcanceltype(oldcanceltype, NULL);
+ pthread_testcancel();
+
+ //Log::getInstance()->log("Audio", Log::DEBUG, "libav out2");
if (!omx_running) {
libav_mutex.Unlock();
- return 0;
+ return *samplepos;
}
- libav_mutex.Unlock();
- // Log::getInstance()->log("Audio", Log::DEBUG,"libav out");
+
if (len>0) {
incoming_paket_libav.data += len;
haveToCopy -= len;
cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
- "OMX_EmptyThisBuffer failed %x", error);
+ "OMX_EmptyThisBuffer 4 failed %x", error);
}
cur_input_buf_omx = NULL;
Log::getInstance()->log("Audio", Log::DEBUG,
"Deliver MediaPacket no free sample");
MILLISLEEP(5);
- if (!omx_running) return 0;
+ if (!omx_running) return *samplepos;
continue;
}
cur_input_buf_omx = input_bufs_omx_free.front();
error = OMX_EmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Audio", Log::DEBUG,
- "OMX_EmptyThisBuffer failed %x", error);
+ "OMX_EmptyThisBuffer 5 failed %x", error);
}
if (packet.synched) vw->AdjustAudioPTS(correctAudioLatency(lastreftimeOMX,cur_input_buf_omx->nFilledLen/(2*2),48000));
cur_input_buf_omx = NULL;
// TODO proper deinit sequence
// first flush all buffers
- error=OMX_SendCommand(omx_vid_rend,OMX_CommandFlush, omx_rend_input_port, NULL);
- if (error!=OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush rend in failed %x", error);
+
+ error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_output_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush codec out failed %x", error);
}
- if (!CommandFinished(omx_vid_rend,OMX_CommandFlush,omx_rend_input_port)) {
- Log::getInstance()->log("Video", Log::DEBUG, "flush cmd shed rend failed");
+ error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush shed in failed %x", error);
+
}
- error=OMX_SendCommand(omx_vid_dec,OMX_CommandFlush, omx_codec_input_port, NULL);
- if (error!=OMX_ErrorNone){
- Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush codec out failed %x", error);
+ if (!CommandFinished(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_output_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd codec failed");
+ }
+ if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_input_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed failed");
}
- error=OMX_SendCommand(omx_vid_sched,OMX_CommandFlush, omx_shed_input_port, NULL);
- if (error!=OMX_ErrorNone){
- Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush shed in failed %x", error);
+
+ error = OMX_SendCommand(omx_vid_rend, OMX_CommandFlush,
+ omx_rend_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush rend in failed %x", error);
}
- if (!CommandFinished(omx_vid_dec,OMX_CommandFlush,omx_codec_output_port) ||
- !CommandFinished(omx_vid_sched,OMX_CommandFlush,omx_shed_input_port)) {
- Log::getInstance()->log("Video", Log::DEBUG, "flush cmd codec shed failed");
+ error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_output_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush shed out failed %x", error);
+
}
+
+ if (!CommandFinished(omx_vid_rend, OMX_CommandFlush,
+ omx_rend_input_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed rend failed");
+ }
+
+ if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_output_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed rend failed");
+ }
+
+
+
+
+
error=OMX_SendCommand(omx_clock,OMX_CommandFlush, omx_clock_output_port, NULL);
if (error!=OMX_ErrorNone){
Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush clock out failed %x", error);
Log::getInstance()->log("Video", Log::DEBUG, "flush cmd clock shed failed");
}
- error=OMX_SendCommand(omx_vid_sched,OMX_CommandFlush, omx_shed_output_port, NULL);
- if (error!=OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush shed out failed %x", error);
- }
+ error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush codec out failed %x", error);
- if (!CommandFinished(omx_vid_sched,OMX_CommandFlush,omx_shed_output_port) ) {
- Log::getInstance()->log("Video", Log::DEBUG, "flush cmd shed rend failed");
}
-
-
DestroyInputBufsOMX();
//todo flushing