[vlc-commits] sout: sdi: drop late samples
Francois Cartegnie
git at videolan.org
Mon Oct 8 18:11:29 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Oct 4 15:02:51 2018 +0200| [57eecb4f6d7cf2d51414d63698455cd1b075d1f8] | committer: Francois Cartegnie
sout: sdi: drop late samples
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=57eecb4f6d7cf2d51414d63698455cd1b075d1f8
---
modules/stream_out/sdi/AES3Audio.cpp | 15 ++++++++++++++-
modules/stream_out/sdi/AES3Audio.hpp | 2 ++
modules/stream_out/sdi/SDIAudioMultiplex.cpp | 10 ++++++++++
modules/stream_out/sdi/SDIAudioMultiplex.hpp | 1 +
4 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/modules/stream_out/sdi/AES3Audio.cpp b/modules/stream_out/sdi/AES3Audio.cpp
index 5352880aa9..39bee4cd95 100644
--- a/modules/stream_out/sdi/AES3Audio.cpp
+++ b/modules/stream_out/sdi/AES3Audio.cpp
@@ -113,10 +113,11 @@ void AES3AudioBuffer::tagConsumed(unsigned f)
void AES3AudioBuffer::forwardTo(vlc_tick_t t)
{
- if(bufferStart() == VLC_TICK_INVALID)
+ if(bufferStart() == VLC_TICK_INVALID || t <= bufferStart())
return;
tagConsumed(TicksDurationToFrames(t - bytestream.p_block->i_pts));
+ flushConsumed();
}
vlc_tick_t AES3AudioBuffer::bufferStart() const
@@ -186,6 +187,12 @@ void AES3AudioSubFrameSource::tagConsumed(unsigned count)
aes3AudioBuffer->tagConsumed(count);
}
+void AES3AudioSubFrameSource::forwardTo(vlc_tick_t t)
+{
+ if(aes3AudioBuffer)
+ aes3AudioBuffer->forwardTo(t);
+}
+
const AES3AudioSubFrameIndex & AES3AudioSubFrameSource::index() const
{
return bufferSubFrameIdx;
@@ -250,6 +257,12 @@ void AES3AudioFrameSource::tagConsumed(unsigned samples)
subframe1.tagConsumed(samples);
}
+void AES3AudioFrameSource::forwardTo(vlc_tick_t t)
+{
+ subframe0.forwardTo(t);
+ subframe1.forwardTo(t);
+}
+
AES3AudioSubFrameIndex::AES3AudioSubFrameIndex(uint8_t v)
{
subframeindex = v;
diff --git a/modules/stream_out/sdi/AES3Audio.hpp b/modules/stream_out/sdi/AES3Audio.hpp
index e35d05607f..322318e15e 100644
--- a/modules/stream_out/sdi/AES3Audio.hpp
+++ b/modules/stream_out/sdi/AES3Audio.hpp
@@ -79,6 +79,7 @@ namespace sdi_sout
void flushConsumed();
void tagConsumed(unsigned);
unsigned availableSamples() const;
+ void forwardTo(vlc_tick_t t);
const AES3AudioSubFrameIndex & index() const;
bool available() const;
@@ -96,6 +97,7 @@ namespace sdi_sout
unsigned availableSamples() const;
void flushConsumed();
void tagConsumed(unsigned);
+ void forwardTo(vlc_tick_t t);
AES3AudioSubFrameSource subframe0;
AES3AudioSubFrameSource subframe1;
};
diff --git a/modules/stream_out/sdi/SDIAudioMultiplex.cpp b/modules/stream_out/sdi/SDIAudioMultiplex.cpp
index 9fe6b4e751..179802028a 100644
--- a/modules/stream_out/sdi/SDIAudioMultiplex.cpp
+++ b/modules/stream_out/sdi/SDIAudioMultiplex.cpp
@@ -321,6 +321,7 @@ const es_format_t *
SDIAudioMultiplex::SDIAudioMultiplex(uint8_t channels)
{
config = SDIAudioMultiplexConfig(channels);
+ head = VLC_TICK_INVALID;
}
SDIAudioMultiplex::~SDIAudioMultiplex()
@@ -387,6 +388,13 @@ block_t * SDIAudioMultiplex::Extract(unsigned samples)
uint8_t interleavedframes = config.getMultiplexedFramesCount();
+ /* Ensure we never roll back due to late fifo */
+ if(head != VLC_TICK_INVALID && start > head)
+ {
+ for(unsigned i=0; i<MAX_AES3_AUDIO_FRAMES; i++)
+ framesources[i].forwardTo(head);
+ }
+
block_t *p_block = block_Alloc( interleavedframes * 2 * sizeof(uint16_t) * samples );
if(!p_block)
return NULL;
@@ -419,5 +427,7 @@ block_t * SDIAudioMultiplex::Extract(unsigned samples)
for(unsigned i=0; i<MAX_AES3_AUDIO_FRAMES; i++)
framesources[i].flushConsumed();
+ head = bufferStart();
+
return p_block;
}
diff --git a/modules/stream_out/sdi/SDIAudioMultiplex.hpp b/modules/stream_out/sdi/SDIAudioMultiplex.hpp
index d65263e1d7..07d73dc39b 100644
--- a/modules/stream_out/sdi/SDIAudioMultiplex.hpp
+++ b/modules/stream_out/sdi/SDIAudioMultiplex.hpp
@@ -92,6 +92,7 @@ namespace sdi_sout
void SetSubFrameSource(uint8_t, AES3AudioBuffer *, AES3AudioSubFrameIndex);
SDIAudioMultiplexConfig config;
+ vlc_tick_t head;
private:
unsigned count;
More information about the vlc-commits
mailing list