Loading StreamRecorder.cpp +10 −14 Changes for StreamRecorder.cpp: 10 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -183,9 +183,7 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d if(((StreamRecorder*)user_data)->isConnectionLost) //Enter only if the connection is lost { // ---------------------------------------------------------------------------------------- long int actualRecordTime; long int currentTime = time(NULL); long int addTime; Loading @@ -195,7 +193,6 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d //cout << "Actual time (timestamp): " << currentTime << endl; actualRecordTime = currentTime-((StreamRecorder*)user_data)->timestamp; cout << "Record time: " << actualRecordTime << endl; // ---------------------------------------------------------------------------------------- /** The calculated record time is greater? */ Loading Loading @@ -229,7 +226,7 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d ((StreamRecorder*)user_data)->isConnectionLost = false; /** Try reconnect with the radio stream*/ g_timeout_add(1*1000, reconnectURIStream, user_data); g_timeout_add(RECONNECTION_DELAY*1000, reconnectURIStream, user_data); } break; Loading @@ -256,20 +253,19 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d /** Not audio stream received */ if(((StreamRecorder*)user_data)->timestamp == 0) { g_timeout_add(1*1000, reconnectURIStream, user_data); g_timeout_add(RECONNECTION_DELAY*1000, reconnectURIStream, user_data); } else { // ---------------------------------------------------------------------------------------- long int actualRecordTime; long int currentTime = time(NULL); long int addTime; cout << "Actual time (timestamp): " << currentTime << endl; //long int addTime; long int bytesToAdd; actualRecordTime = currentTime - ((StreamRecorder *)user_data)->timestamp; cout << "Record time: " << actualRecordTime << endl; // ---------------------------------------------------------------------------------------- /** Record time is greater than th required */ if (actualRecordTime >= ((StreamRecorder *) user_data)->audioFileDuration) Loading @@ -279,12 +275,12 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d } else { /** Moves the pointer to the position corresponding to the difference of the timestamps */ addTime = currentTime - ((StreamRecorder *) user_data)->oldTmpTimestamp; /** Moves the pointer to the position corresponding to the difference of the timestamps */ //addTime = currentTime - ((StreamRecorder *) user_data)->oldTmpTimestamp; cout << "Time to add: " << 1 << endl; long int bytesToAdd = 1*READSIZE*STREAMRECORDER_BYTESPERSAMPLE*10; bytesToAdd = 1*READSIZE*STREAMRECORDER_BYTESPERSAMPLE*10; cout << "-------------------------------------" << endl; cout << "Actual Bytes number: " << "(" << ((StreamRecorder *) user_data)->nBytes << ") + "; Loading @@ -303,7 +299,7 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d ((StreamRecorder*)user_data)->isConnectionLost = false; /** Try reconnect with the radio stream*/ g_timeout_add(1*1000, reconnectURIStream, user_data); g_timeout_add(RECONNECTION_DELAY*1000, reconnectURIStream, user_data); } } Loading StreamRecorder.h +1 −0 Changes for StreamRecorder.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #define ERROR_MSG_SIZE 50 #define DST_URI_SIZE 80 #define RECONNECTION_DELAY 1 //------------------------------------------------------------------------------ Loading Loading
StreamRecorder.cpp +10 −14 Changes for StreamRecorder.cpp: 10 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -183,9 +183,7 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d if(((StreamRecorder*)user_data)->isConnectionLost) //Enter only if the connection is lost { // ---------------------------------------------------------------------------------------- long int actualRecordTime; long int currentTime = time(NULL); long int addTime; Loading @@ -195,7 +193,6 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d //cout << "Actual time (timestamp): " << currentTime << endl; actualRecordTime = currentTime-((StreamRecorder*)user_data)->timestamp; cout << "Record time: " << actualRecordTime << endl; // ---------------------------------------------------------------------------------------- /** The calculated record time is greater? */ Loading Loading @@ -229,7 +226,7 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d ((StreamRecorder*)user_data)->isConnectionLost = false; /** Try reconnect with the radio stream*/ g_timeout_add(1*1000, reconnectURIStream, user_data); g_timeout_add(RECONNECTION_DELAY*1000, reconnectURIStream, user_data); } break; Loading @@ -256,20 +253,19 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d /** Not audio stream received */ if(((StreamRecorder*)user_data)->timestamp == 0) { g_timeout_add(1*1000, reconnectURIStream, user_data); g_timeout_add(RECONNECTION_DELAY*1000, reconnectURIStream, user_data); } else { // ---------------------------------------------------------------------------------------- long int actualRecordTime; long int currentTime = time(NULL); long int addTime; cout << "Actual time (timestamp): " << currentTime << endl; //long int addTime; long int bytesToAdd; actualRecordTime = currentTime - ((StreamRecorder *)user_data)->timestamp; cout << "Record time: " << actualRecordTime << endl; // ---------------------------------------------------------------------------------------- /** Record time is greater than th required */ if (actualRecordTime >= ((StreamRecorder *) user_data)->audioFileDuration) Loading @@ -279,12 +275,12 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d } else { /** Moves the pointer to the position corresponding to the difference of the timestamps */ addTime = currentTime - ((StreamRecorder *) user_data)->oldTmpTimestamp; /** Moves the pointer to the position corresponding to the difference of the timestamps */ //addTime = currentTime - ((StreamRecorder *) user_data)->oldTmpTimestamp; cout << "Time to add: " << 1 << endl; long int bytesToAdd = 1*READSIZE*STREAMRECORDER_BYTESPERSAMPLE*10; bytesToAdd = 1*READSIZE*STREAMRECORDER_BYTESPERSAMPLE*10; cout << "-------------------------------------" << endl; cout << "Actual Bytes number: " << "(" << ((StreamRecorder *) user_data)->nBytes << ") + "; Loading @@ -303,7 +299,7 @@ int StreamRecorder::bus_callback (GstBus *bus, GstMessage *message, void *user_d ((StreamRecorder*)user_data)->isConnectionLost = false; /** Try reconnect with the radio stream*/ g_timeout_add(1*1000, reconnectURIStream, user_data); g_timeout_add(RECONNECTION_DELAY*1000, reconnectURIStream, user_data); } } Loading
StreamRecorder.h +1 −0 Changes for StreamRecorder.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #define ERROR_MSG_SIZE 50 #define DST_URI_SIZE 80 #define RECONNECTION_DELAY 1 //------------------------------------------------------------------------------ Loading