diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2014-02-26 17:37:15 +0100 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2014-02-26 17:37:15 +0100 |
| commit | caf8862080d1a858bcdfb39dfe6371ec3892bd31 (patch) | |
| tree | 12783eb66fab98c7876117cb658e027cc195064b | |
| parent | 7f64c0f3be9587e3abb0cac4f6d1d28a99c7dc44 (diff) | |
| download | vdr-plugin-rpihddevice-caf8862080d1a858bcdfb39dfe6371ec3892bd31.tar.gz vdr-plugin-rpihddevice-caf8862080d1a858bcdfb39dfe6371ec3892bd31.tar.bz2 | |
force appending audio packets to parser even if it's not yet ready when in transfer mode
| -rw-r--r-- | audio.c | 13 | ||||
| -rw-r--r-- | audio.h | 6 | ||||
| -rw-r--r-- | omxdevice.c | 8 |
3 files changed, 21 insertions, 6 deletions
@@ -689,16 +689,23 @@ int cAudioDecoder::DeInit(void) return 0; } -bool cAudioDecoder::WriteData(const unsigned char *buf, unsigned int length, uint64_t pts) +bool cAudioDecoder::WriteData(const unsigned char *buf, unsigned int length, + uint64_t pts, bool force) { Lock(); bool ret = false; - if (m_ready) + // normally, only accept new audio packet if parser is empty. appending + // new data may be forced in transfer mode, can't be tracked in this case + if (m_ready || force) { if (m_parser->Append(buf, length)) { - m_pts = pts; + if (m_ready) + m_pts = pts; + else + DBG("audio parser not empty, pts discarded"); + m_ready = false; m_wait->Signal(); ret = true; @@ -29,7 +29,8 @@ public: virtual int Init(void); virtual int DeInit(void); - virtual bool WriteData(const unsigned char *buf, unsigned int length, uint64_t pts = 0); + virtual bool WriteData(const unsigned char *buf, unsigned int length, + uint64_t pts = 0, bool force = false); virtual bool Poll(void); virtual void Reset(void); @@ -37,7 +38,8 @@ public: protected: virtual void Action(void); - void SetCodec(cAudioCodec::eCodec codec, unsigned int &channels, unsigned int samplingRate); + void SetCodec(cAudioCodec::eCodec codec, unsigned int &channels, + unsigned int samplingRate); struct Codec { diff --git a/omxdevice.c b/omxdevice.c index b58f010..fb785fd 100644 --- a/omxdevice.c +++ b/omxdevice.c @@ -200,7 +200,10 @@ int cOmxDevice::PlayAudio(const uchar *Data, int Length, uchar Id) UpdateLatency(pts); int ret = m_audio->WriteData(Data + PesPayloadOffset(Data), - Length - PesPayloadOffset(Data), pts) ? Length : 0; + Length - PesPayloadOffset(Data), pts, Transferring()) ? Length : 0; + + if (Transferring() && !ret) + DLOG("audio packet not accepted! (%d bytes)", Length); m_mutex->Unlock(); return ret; @@ -294,6 +297,9 @@ int cOmxDevice::PlayVideo(const uchar *Data, int Length, bool singleFrame) } } + if (Transferring() && !ret) + DLOG("video packet not accepted! (%d bytes)", Length); + m_mutex->Unlock(); return ret; } |
