Ticket #1271: mencoder_03_joint_av_eof.diff

File mencoder_03_joint_av_eof.diff, 1.2 KB (added by rectalogic@…, 17 years ago)

mencoder_03_joint_av_eof.diff

  • mencoder.c

    old new  
    11201120
    11211121if(sh_audio){
    11221122    // get audio:
    1123     while(!sh_video || mux_a->timer-audio_preload<mux_v->timer){
     1123    while(!sh_video || mux_a->timer-audio_preload<mux_v->timer || d_video->eof){
    11241124        float tottime;
    11251125        int len=0;
    11261126
     
    12011201                }
    12021202            }
    12031203        }
    1204         if(len<=0) {
    1205             if(!sh_video) at_eof=1;
    1206             break; // EOF?
    1207         }
    12081204        muxer_write_chunk(mux_a,len,0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
    12091205        if(!mux_a->h.dwSampleSize && mux_a->timer>0)
    12101206            mux_a->wf->nAvgBytesPerSec=0.5f+(double)mux_a->size/mux_a->timer; // avg bps (VBR)
     
    12171213        audiosamples++;
    12181214        audiorate+= (GetTimerMS() - ptimer_start);
    12191215
     1216        if(d_audio->eof) {
     1217            if(!sh_video) at_eof=1;
     1218            break;
     1219        }
    12201220    }
    12211221}
    12221222
     
    12281228        sh_video->timer+=frame_data.frame_time;
    12291229    }
    12301230    frame_data.frame_time /= playback_speed;
    1231     if(frame_data.in_size<0){ at_eof=1; break; }
     1231    if (d_video->eof) {
     1232      if (!sh_audio || d_audio->eof)
     1233        at_eof=1;
     1234      continue;
     1235    }
    12321236    ++decoded_frameno;
    12331237
    12341238    v_timer_corr-=frame_data.frame_time-(float)mux_v->h.dwScale/mux_v->h.dwRate;