[Ffmpeg-cvslog] CVS: ffmpeg ffplay.c,1.43,1.44

Michael Niedermayer CVS michael
Fri Jun 24 10:32:58 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg
In directory mail:/var2/tmp/cvs-serv25860

Modified Files:
	ffplay.c 
Log Message:
ffplay crashes patch by (Ivan Wong: email, ivanwong info)


Index: ffplay.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/ffplay.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- ffplay.c	7 Jun 2005 21:53:56 -0000	1.43
+++ ffplay.c	24 Jun 2005 08:32:55 -0000	1.44
@@ -218,6 +218,7 @@
 {
     AVPacketList *pkt, *pkt1;
 
+    SDL_LockMutex(q->mutex);
     for(pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {
         pkt1 = pkt->next;
         av_free_packet(&pkt->pkt);
@@ -227,6 +228,7 @@
     q->first_pkt = NULL;
     q->nb_packets = 0;
     q->size = 0;
+    SDL_UnlockMutex(q->mutex);
 }
 
 static void packet_queue_end(PacketQueue *q)
@@ -612,9 +614,11 @@
 /* seek in the stream */
 static void stream_seek(VideoState *is, int64_t pos, int rel)
 {
-    is->seek_pos = pos;
-    is->seek_req = 1;
-    is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0;
+    if (!is->seek_req) {
+        is->seek_pos = pos;
+        is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0;
+        is->seek_req = 1;
+    }
 }
 
 /* pause or resume the video */
@@ -1430,6 +1434,8 @@
 #endif
         if (is->seek_req) {
             /* XXX: must lock decoder threads */
+            SDL_LockMutex(is->video_decoder_mutex);
+            SDL_LockMutex(is->audio_decoder_mutex);
             ret = av_seek_frame(is->ic, -1, is->seek_pos, is->seek_flags);
             if (ret < 0) {
                 fprintf(stderr, "%s: error while seeking\n", is->ic->filename);
@@ -1439,11 +1445,11 @@
                 }
                 if (is->video_stream >= 0) {
                     packet_queue_flush(&is->videoq);
-                    SDL_LockMutex(is->video_decoder_mutex);
                     avcodec_flush_buffers(&ic->streams[video_index]->codec);
-                    SDL_UnlockMutex(is->video_decoder_mutex);
                 }
             }
+            SDL_UnlockMutex(is->audio_decoder_mutex);
+            SDL_UnlockMutex(is->video_decoder_mutex);
             is->seek_req = 0;
         }
 





More information about the ffmpeg-cvslog mailing list