version 3.02

This commit is contained in:
Bramfeld Team 2016-02-28 20:50:31 +01:00
parent 7adaaf99be
commit bc32a3a706
25 changed files with 287 additions and 99 deletions

View file

@ -23,7 +23,7 @@
// Description: persistent cache on disk for xcodec protocol streams //
// Project: WANProxy XTech //
// Adapted by: Andreu Vidal Bramfeld-Software //
// Last modified: 2015-08-31 //
// Last modified: 2016-02-28 //
// //
////////////////////////////////////////////////////////////////////////////////
@ -61,6 +61,9 @@ XCodecCacheCOSS::XCodecCacheCOSS (const UUID& uuid, const std::string& cache_dir
directory_ = new COSSMetadata[stripe_limit_];
memset (directory_, 0, sizeof (COSSMetadata) * stripe_limit_);
if (stream_.rdbuf())
stream_.rdbuf()->pubsetbuf (0, 0);
stream_.open (file_path_.c_str(), fstream::in | fstream::out | fstream::binary);
if (! read_file ())
{

View file

@ -38,7 +38,7 @@
// Description: decoding routines for the xcodex protocol //
// Project: WANProxy XTech //
// Adapted by: Andreu Vidal Bramfeld-Software //
// Last modified: 2015-08-31 //
// Last modified: 2016-02-28 //
// //
////////////////////////////////////////////////////////////////////////////////

View file

@ -36,7 +36,7 @@
// Description: encoding routines for the xcodex protocol //
// Project: WANProxy XTech //
// Adapted by: Andreu Vidal Bramfeld-Software //
// Last modified: 2015-08-31 //
// Last modified: 2016-02-28 //
// //
////////////////////////////////////////////////////////////////////////////////
@ -57,7 +57,7 @@ XCodecEncoder::~XCodecEncoder()
* escaped.
*/
void XCodecEncoder::encode (Buffer& output, Buffer& input, bool wait)
void XCodecEncoder::encode (Buffer& output, Buffer& input)
{
int off = source_.length ();
Buffer old;
@ -170,9 +170,6 @@ void XCodecEncoder::encode (Buffer& output, Buffer& input, bool wait)
}
}
}
if (! wait)
flush (output);
}
bool XCodecEncoder::flush (Buffer& output)

View file

@ -34,7 +34,7 @@
// Description: encoding routines for the xcodex protocol //
// Project: WANProxy XTech //
// Adapted by: Andreu Vidal Bramfeld-Software //
// Last modified: 2015-08-31 //
// Last modified: 2016-02-28 //
// //
////////////////////////////////////////////////////////////////////////////////
@ -53,7 +53,7 @@ public:
XCodecEncoder(XCodecCache*);
~XCodecEncoder();
void encode (Buffer&, Buffer&, bool);
void encode (Buffer&, Buffer&);
bool flush (Buffer&);
private:

View file

@ -25,6 +25,7 @@
#include <common/buffer.h>
#include <common/endian.h>
#include <common/count_filter.h>
#include <event/event_system.h>
#include <programs/wanproxy/wanproxy.h>
#include "xcodec_filter.h"
@ -35,7 +36,7 @@
// Description: instantiation of encoder/decoder in a data filter pair //
// Project: WANProxy XTech //
// Adapted by: Andreu Vidal Bramfeld-Software //
// Last modified: 2015-08-31 //
// Last modified: 2016-02-28 //
// //
////////////////////////////////////////////////////////////////////////////////
@ -119,7 +120,7 @@
// Encoding
bool EncodeFilter::consume (Buffer& buf)
bool EncodeFilter::consume (Buffer& buf, int flg)
{
Buffer enc, output;
@ -143,18 +144,24 @@ bool EncodeFilter::consume (Buffer& buf)
return false;
}
encoder_->encode (enc, buf, waiting_);
encoder_->encode (enc, buf);
if (! (flg & TO_BE_CONTINUED))
{
if (waiting_)
{
if (wait_action_)
wait_action_->cancel ();
wait_action_ = event_system.track (150, StreamModeWait, callback (this, &EncodeFilter::on_read_timeout));
}
else
encoder_->flush (enc);
}
while (! enc.empty ())
encode_frame (enc, output);
if (waiting_)
{
if (wait_action_)
wait_action_->cancel ();
wait_action_ = event_system.track (150, StreamModeWait, callback (this, &EncodeFilter::on_read_timeout));
}
return (! output.empty () ? produce (output) : true);
return (! output.empty () ? produce (output, flg) : true);
}
void EncodeFilter::flush (int flg)
@ -165,10 +172,12 @@ void EncodeFilter::flush (int flg)
{
flushing_ = true;
flush_flags_ |= flg;
if (wait_action_)
wait_action_->cancel (), wait_action_ = 0;
if (! sent_eos_)
{
Buffer enc, output;
if (waiting_ && encoder_ && encoder_->flush (enc))
if (encoder_ && encoder_->flush (enc))
encode_frame (enc, output);
output.append (XCODEC_PIPE_OP_EOS);
sent_eos_ = produce (output);
@ -200,7 +209,7 @@ void EncodeFilter::on_read_timeout (Event e)
wait_action_->cancel (), wait_action_ = 0;
Buffer enc, output;
if (encoder_ && encoder_->flush (enc))
if (! flushing_ && encoder_ && encoder_->flush (enc))
{
encode_frame (enc, output);
produce (output);
@ -209,7 +218,7 @@ void EncodeFilter::on_read_timeout (Event e)
// Decoding
bool DecodeFilter::consume (Buffer& buf)
bool DecodeFilter::consume (Buffer& buf, int flg)
{
if (! upstream_)
{
@ -412,7 +421,7 @@ bool DecodeFilter::consume (Buffer& buf)
if (! output.empty ())
{
ASSERT(log_, ! flushing_);
if (! produce (output))
if (! produce (output, flg))
return false;
}
else
@ -512,7 +521,7 @@ void DecodeFilter::flush (int flg)
if (! frame_buffer_.empty ())
DEBUG(log_) << "Flushing decoder with frame data outstanding.";
if (! upflushed_ && upstream_)
upstream_->flush (XCODEC_PIPE_OP_EOS_ACK);
upflushed_ = true, upstream_->flush (XCODEC_PIPE_OP_EOS_ACK);
Filter::flush (flush_flags_);
}

View file

@ -4,7 +4,7 @@
// Description: instantiation of encoder/decoder in a data filter pair //
// Project: WANProxy XTech //
// Author: Andreu Vidal Bramfeld-Software //
// Last modified: 2015-08-31 //
// Last modified: 2016-02-28 //
// //
////////////////////////////////////////////////////////////////////////////////
@ -44,7 +44,7 @@ public:
delete encoder_;
}
virtual bool consume (Buffer& buf);
virtual bool consume (Buffer& buf, int flg = 0);
virtual void flush (int flg);
private:
@ -77,7 +77,7 @@ public:
delete decoder_;
}
virtual bool consume (Buffer& buf);
virtual bool consume (Buffer& buf, int flg = 0);
virtual void flush (int flg);
};