修复bug

This commit is contained in:
xia-chu 2021-02-09 14:01:10 +08:00
parent e4904623a7
commit b7f4eae2bc
6 changed files with 7 additions and 7 deletions

View File

@ -54,7 +54,7 @@ DecoderImp::Ptr DecoderImp::createDecoder(Type type, MediaSinkInterface *sink){
return DecoderImp::Ptr(new DecoderImp(decoder, sink)); return DecoderImp::Ptr(new DecoderImp(decoder, sink));
} }
size_t DecoderImp::input(const uint8_t *data, size_t bytes){ ssize_t DecoderImp::input(const uint8_t *data, size_t bytes){
return _decoder->input(data, bytes); return _decoder->input(data, bytes);
} }

View File

@ -25,7 +25,7 @@ public:
typedef std::function<void(int stream, int codecid, int flags, int64_t pts, int64_t dts, const void *data, size_t bytes)> onDecode; typedef std::function<void(int stream, int codecid, int flags, int64_t pts, int64_t dts, const void *data, size_t bytes)> onDecode;
typedef std::function<void(int stream, int codecid, const void *extra, size_t bytes, int finish)> onStream; typedef std::function<void(int stream, int codecid, const void *extra, size_t bytes, int finish)> onStream;
virtual size_t input(const uint8_t *data, size_t bytes) = 0; virtual ssize_t input(const uint8_t *data, size_t bytes) = 0;
virtual void setOnDecode(onDecode cb) = 0; virtual void setOnDecode(onDecode cb) = 0;
virtual void setOnStream(onStream cb) = 0; virtual void setOnStream(onStream cb) = 0;
@ -57,7 +57,7 @@ public:
~DecoderImp() = default; ~DecoderImp() = default;
static Ptr createDecoder(Type type, MediaSinkInterface *sink); static Ptr createDecoder(Type type, MediaSinkInterface *sink);
size_t input(const uint8_t *data, size_t bytes); ssize_t input(const uint8_t *data, size_t bytes);
protected: protected:
void onTrack(const Track::Ptr &track); void onTrack(const Track::Ptr &track);

View File

@ -44,7 +44,7 @@ PSDecoder::~PSDecoder() {
ps_demuxer_destroy((struct ps_demuxer_t*)_ps_demuxer); ps_demuxer_destroy((struct ps_demuxer_t*)_ps_demuxer);
} }
size_t PSDecoder::input(const uint8_t *data, size_t bytes) { ssize_t PSDecoder::input(const uint8_t *data, size_t bytes) {
return ps_demuxer_input((struct ps_demuxer_t*)_ps_demuxer,data,bytes); return ps_demuxer_input((struct ps_demuxer_t*)_ps_demuxer,data,bytes);
} }

View File

@ -21,7 +21,7 @@ class PSDecoder : public Decoder {
public: public:
PSDecoder(); PSDecoder();
~PSDecoder(); ~PSDecoder();
size_t input(const uint8_t* data, size_t bytes) override; ssize_t input(const uint8_t* data, size_t bytes) override;
void setOnDecode(onDecode cb) override; void setOnDecode(onDecode cb) override;
void setOnStream(onStream cb) override; void setOnStream(onStream cb) override;

View File

@ -77,7 +77,7 @@ TSDecoder::~TSDecoder() {
ts_demuxer_destroy(_demuxer_ctx); ts_demuxer_destroy(_demuxer_ctx);
} }
size_t TSDecoder::input(const uint8_t *data, size_t bytes) { ssize_t TSDecoder::input(const uint8_t *data, size_t bytes) {
if (TSSegment::isTSPacket((char *)data, bytes)) { if (TSSegment::isTSPacket((char *)data, bytes)) {
return ts_demuxer_input(_demuxer_ctx, (uint8_t *) data, bytes); return ts_demuxer_input(_demuxer_ctx, (uint8_t *) data, bytes);
} }

View File

@ -45,7 +45,7 @@ class TSDecoder : public Decoder {
public: public:
TSDecoder(); TSDecoder();
~TSDecoder(); ~TSDecoder();
size_t input(const uint8_t* data, size_t bytes) override ; ssize_t input(const uint8_t* data, size_t bytes) override ;
void setOnDecode(onDecode cb) override; void setOnDecode(onDecode cb) override;
void setOnStream(onStream cb) override; void setOnStream(onStream cb) override;