From 82c116716aead4e45c2e97f8d6e3fa8bd255a718 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 5 Nov 2010 12:21:25 +0100 Subject: [PATCH] Buffer crash probleem fixed --- Buffer/user.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Buffer/user.cpp b/Buffer/user.cpp index 41948f80..19c2878e 100644 --- a/Buffer/user.cpp +++ b/Buffer/user.cpp @@ -64,10 +64,16 @@ void user::Send(buffer ** ringbuf, int buffers){ //completed a send - switch to next buffer if ((ringbuf[MyBuffer]->number != MyBuffer_num)){ std::cout << "Warning: User " << MyNum << " was send corrupt video data and send to the next keyframe!" << std::endl; + int nocrashcount = 0; do{ MyBuffer++; + nocrashcount++; MyBuffer %= buffers; - }while(!ringbuf[MyBuffer]->FLV->isKeyframe); + }while(!ringbuf[MyBuffer]->FLV->isKeyframe && (nocrashcount < buffers)); + if (nocrashcount >= buffers){ + std::cout << "Warning: No keyframe found in buffers! Skipping search for now..." << std::endl; + return; + } }else{ MyBuffer++; MyBuffer %= buffers;