[mythtv] Seg. fault during WatchingRecording -> WatchingLiveTV

Gregorio Gervasio Jr. gtgj at pacbell.net
Thu Mar 6 10:27:21 EST 2003


	I've been getting frequent seg. faults when transitioning from
WatchingRecording to WatchingLiveTV.  Another recording is set to
start immediately, but it may not be significant.  Here is a backtrace
using CVS from about two days ago:


Changing from WatchingLiveTV to WatchingRecording
Changing from WatchingRecording to WatchingLiveTV

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 49159 (LWP 26327)]
mpeg4_encode_picture_header (s=0x8570ae0, picture_number=53830) at bswap.h:19
Current language:  auto; currently c
(gdb) bt
#0  mpeg4_encode_picture_header (s=0x8570ae0, picture_number=53830)
    at bswap.h:19
#1  0x080e3dac in encode_picture (s=0x8570ae0, picture_number=53830)
    at mpegvideo.c:3079
#2  0x080e1879 in MPV_encode_picture (avctx=0x84dd770, buf=0x44f32008 "", 
    buf_size=345600, data=0x43444190) at mpegvideo.c:1313
#3  0x080de8f8 in avcodec_encode_video (avctx=0x84dd770, buf=0x44f32008 "", 
    buf_size=345600, pict=0x43444190) at utils.c:303
#4  0x080ae01c in NuppelVideoRecorder::WriteVideo(unsigned char*, int, int, int) (this=0x43330008, 
    buf=0x43b93008 "\020\020\020\020\020\022\030\e\032\036%$$+.)# !*)'((()'\"#%%###!\032\034&,,,-,11/+# #%$&&# \037\037###$%'&%$&%\036\e &-100//-,--.,,/--.*('\"#-,*-10'#*11377465*\037\037$&$$%\"$$$#!\"\037%'$&$!!$%$$\"#%###\"%%!!\"\"\"$#!$)+(&*0.,/.%!'+,+)/1,$!\"$  \"#\036\037$$&#\037!$#!%#!#"..., len=345600, 
    fnum=165746, timecode=-33) at NuppelVideoRecorder.cpp:2037
#5  0x080adadc in NuppelVideoRecorder::doWriteThread() (this=0x43330008)
    at /usr/include/c++/3.2/bits/stl_vector.h:289
#6  0x080acd64 in NuppelVideoRecorder::WriteThread(void*) (param=0x43330008)
    at NuppelVideoRecorder.cpp:1393
#7  0x407af941 in pthread_start_thread () from /lib/i686/libpthread.so.0
#8  0x407afa45 in pthread_start_thread_event () from /lib/i686/libpthread.so.0
(gdb) p s->pb
$2 = {bit_buf = 4294967295, bit_left = 1, buf = 0x44f32008 "", 
  buf_ptr = 0x45095000 "", buf_end = 0x44f86608 'ÿ' <repeats 200 times>..., 
  data_out_size = 0}
(gdb) p time_incr
$6 = -11632575
(gdb) p time_div
$8 = -11632575
(gdb) p s->time
$10 = 0


(line 19 of bswap.h is be2me_32() which is used by put_bits() in
common.h, and they're both inlined in mpeg4_encode_picture_header.)

        I won't pretend to understand how things are supposed to work
but it looks like the encoder can't handle the time base getting reset
to zero.  The following hack seems to avoid the problem, but what's the
right thing to do in this case?

        It doesn't happen all the time but it's pretty frequent now
whereas I never seemed to notice it happening before.   My guess is
that it started happening after I reduced picture size to 480x480 (bit
rate is 2000 before scaling) so it may be a timing thing exposed by
reduced processing load.


Index: libs/libavcodec/h263.c
===================================================================
RCS file: /var/lib/cvs/MC/libs/libavcodec/h263.c,v
retrieving revision 1.26
diff -u -r1.26 h263.c
--- libs/libavcodec/h263.c	20 Feb 2003 03:10:33 -0000	1.26
+++ libs/libavcodec/h263.c	6 Mar 2003 17:55:24 -0000
@@ -1775,6 +1775,10 @@
     time_div= s->time/s->time_increment_resolution;
     time_mod= s->time%s->time_increment_resolution;
     time_incr= time_div - s->last_time_base;
+    if(time_incr<0){
+        fprintf(stderr,"time_incr reset\n");
+        time_incr= 0;
+    }
     while(time_incr--)
         put_bits(&s->pb, 1, 1);
         

-- 
Gregorio Gervasio, Jr.
gtgj at pacbell.net



More information about the mythtv-dev mailing list