diff options
author | deva <deva> | 2005-06-02 15:03:23 +0000 |
---|---|---|
committer | deva <deva> | 2005-06-02 15:03:23 +0000 |
commit | 907dbf7e8915fb459e4ab1482fd4dbd8c8ea50d4 (patch) | |
tree | 5c6278093dc03a4b2fe35dc6c8a76aef15eea106 | |
parent | df793bb0657844c98c0505f47db80798b4ad495e (diff) |
Fixed crash in network.cc if socket not connected.
Added option to skop ecery second frame in player
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | etc/miav.conf | 3 | ||||
-rw-r--r-- | src/decoder.cc | 11 | ||||
-rw-r--r-- | src/info_gui.cc | 2 | ||||
-rw-r--r-- | src/network.cc | 23 | ||||
-rw-r--r-- | src/socket.cc | 8 |
7 files changed, 50 insertions, 7 deletions
@@ -2,6 +2,14 @@ Changelog for MIaV ======================================= +Juni NN 2005 - MIaV version 0.2.4 +--------------------------------------- +New Features: + - Skip every other frame, in player window, in order to save resources. +Bug Fixes: + - Fixed crash, when socket could not connect. + +======================================= May 26 2005 - MIaV version 0.2.3 --------------------------------------- New Features: diff --git a/configure.in b/configure.in index bd27476..fba5a2b 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ # Filename: configure.in AC_INIT(src/miav.cc) -AM_INIT_AUTOMAKE( miav, 0.2.3 ) +AM_INIT_AUTOMAKE( miav, 0.2.4 ) AC_PROG_CXX diff --git a/etc/miav.conf b/etc/miav.conf index de58ac8..1b5bb62 100644 --- a/etc/miav.conf +++ b/etc/miav.conf @@ -16,6 +16,9 @@ screensize = 19.0 pixel_width = 1024 pixel_height = 768 +# Set to 1 if client is slow ( less than 1.5 ghz ) +player_skip_frames = 1 + # How and where to connect to the miav server? server_addr = "127.0.0.1" server_port = 18120 diff --git a/src/decoder.cc b/src/decoder.cc index db95fe8..ec3f695 100644 --- a/src/decoder.cc +++ b/src/decoder.cc @@ -39,6 +39,11 @@ /* * $Log$ + * Revision 1.30 2005/06/02 15:03:23 deva + * + * Fixed crash in network.cc if socket not connected. + * Added option to skop ecery second frame in player + * * Revision 1.29 2005/05/25 13:11:42 deva * * Made unfreeze close connection, when no recording is done. @@ -80,6 +85,8 @@ #include <errno.h> */ +#include "miav_config.h" + #include <time.h> // Use libdv @@ -131,6 +138,8 @@ void Decoder::decode() bool local_record = false; bool old_record; + bool skip_frames = config->readInt("player_skip_frames"); + dv1394 dv_stream = dv1394(info); // Use default port and channel. while(*running) { @@ -174,7 +183,7 @@ void Decoder::decode() } static int showframe = 1; - // showframe = 1 - showframe; + if(skip_frames != 0) showframe = 1 - showframe; if(showframe) { Frame *pframe = new Frame(ptr, DVPACKAGE_SIZE); pframe->shoot = local_shoot; diff --git a/src/info_gui.cc b/src/info_gui.cc index b084b00..4865ae0 100644 --- a/src/info_gui.cc +++ b/src/info_gui.cc @@ -46,7 +46,7 @@ bool InfoEventHandler::eventFilter( QObject *o, QEvent *e ) { if ( e->type() == TYPE_SHOW_MESSAGEBOX ) { - fprintf(stderr, "Custom event!\n"); fflush(stderr); + // fprintf(stderr, "Custom event!\n"); fflush(stderr); MessageBox *msgbox = ((ShowMessageEvent*)e)->messagebox(); msgbox->exec(); delete msgbox; diff --git a/src/network.cc b/src/network.cc index 05835c0..d21b8fe 100644 --- a/src/network.cc +++ b/src/network.cc @@ -31,6 +31,11 @@ /* * $Log$ + * Revision 1.5 2005/06/02 15:03:23 deva + * + * Fixed crash in network.cc if socket not connected. + * Added option to skop ecery second frame in player + * * Revision 1.4 2005/05/03 08:31:59 deva * Removed the error object, and replaced it with a more generic info object. * @@ -59,8 +64,8 @@ Network::~Network() int Network::write(void *buf, int size) { if(!s->isConnected()) { - info->error("Write attempted to a socket not connected!"); - return 0; + // info->error("Write attempted to a socket not connected!"); + return -1; } int n = send(s->ssocket, buf, size, MSG_WAITALL); @@ -74,8 +79,8 @@ int Network::write(void *buf, int size) int Network::read(void *buf, int size) { if(!s->isConnected()) { - info->error("Read attempted from a socket not connected!"); - return 0; + // info->error("Read attempted from a socket not connected!"); + return -1; } int n = recv(s->ssocket, buf, size, MSG_WAITALL); @@ -103,6 +108,11 @@ int Network::sendPackage(n_header *h, void* buf, int bufsz) struct msghdr msg; struct iovec iovecs[2]; + if(!s->isConnected()) { + // info->error("Write attempted to a socket not connected!"); + return -1; + } + memset(&msg, 0, sizeof(msg)); msg.msg_iov = iovecs; @@ -128,6 +138,11 @@ int Network::recvPackage(n_header *h, void* buf, int bufsz) struct msghdr msg; struct iovec iovecs[2]; + if(!s->isConnected()) { + // info->error("Read attempted to a socket not connected!"); + return -1; + } + memset(&msg, 0, sizeof(msg)); iovecs[0].iov_base = h; diff --git a/src/socket.cc b/src/socket.cc index c01e31d..c5a2575 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -31,6 +31,11 @@ /* * $Log$ + * Revision 1.6 2005/06/02 15:03:23 deva + * + * Fixed crash in network.cc if socket not connected. + * Added option to skop ecery second frame in player + * * Revision 1.5 2005/05/03 17:13:25 deva * Fixed some missong Info object references. * @@ -120,6 +125,7 @@ Socket Socket::slisten() (socklen_t*)&csalen); if (s.ssocket < 0) { + s.connected = false; err = 1; info->error("Socket: accept() failed! %s", strerror(errno)); return s; @@ -134,6 +140,7 @@ Socket Socket::slisten() int Socket::sconnect(char *ip) { if(err) { + connected = false; info->error("Socket: No socket present!"); return err; } @@ -144,6 +151,7 @@ int Socket::sconnect(char *ip) err = connect(ssocket, (struct sockaddr*)&socketaddr, sizeof(socketaddr)); if (err) { + connected = false; info->error("Socket: connect() failed! %s", strerror(errno)); return err; } |