comparison nutenc.c @ 6471:b3aea89a4f63 libavformat

nutenc: fix unstable floating-point calculations
author mru
date Fri, 10 Sep 2010 13:16:08 +0000
parents 79fc252c65cd
children
comparison
equal deleted inserted replaced
6470:5d5fbab4d608 6471:b3aea89a4f63
559 nut->time_base[j]= time_base; 559 nut->time_base[j]= time_base;
560 nut->stream[i].time_base= &nut->time_base[j]; 560 nut->stream[i].time_base= &nut->time_base[j];
561 if(j==nut->time_base_count) 561 if(j==nut->time_base_count)
562 nut->time_base_count++; 562 nut->time_base_count++;
563 563
564 if(av_q2d(time_base) >= 0.001) 564 if(INT64_C(1000) * time_base.num >= time_base.den)
565 nut->stream[i].msb_pts_shift = 7; 565 nut->stream[i].msb_pts_shift = 7;
566 else 566 else
567 nut->stream[i].msb_pts_shift = 14; 567 nut->stream[i].msb_pts_shift = 14;
568 nut->stream[i].max_pts_distance= FFMAX(1/av_q2d(time_base), 1); 568 nut->stream[i].max_pts_distance= FFMAX(time_base.den, time_base.num) / time_base.num;
569 } 569 }
570 570
571 nut->max_distance = MAX_DISTANCE; 571 nut->max_distance = MAX_DISTANCE;
572 build_elision_headers(s); 572 build_elision_headers(s);
573 build_frame_code(s); 573 build_frame_code(s);