diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-10-01 15:41:31 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-10-01 15:41:31 +0200 |
commit | 48e7a18d4002ac82249002a36a5d89c1cea16f32 (patch) | |
tree | 9c31fcc3c542f08c28c4998fb56aef27df2d82b3 /src/odr-sourcecompanion.cpp | |
parent | c26b7422683538d90e28210a31b2f618ede631a8 (diff) | |
download | ODR-SourceCompanion-48e7a18d4002ac82249002a36a5d89c1cea16f32.tar.gz ODR-SourceCompanion-48e7a18d4002ac82249002a36a5d89c1cea16f32.tar.bz2 ODR-SourceCompanion-48e7a18d4002ac82249002a36a5d89c1cea16f32.zip |
Fix EDI output frame sizes
Diffstat (limited to 'src/odr-sourcecompanion.cpp')
-rw-r--r-- | src/odr-sourcecompanion.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/odr-sourcecompanion.cpp b/src/odr-sourcecompanion.cpp index 6647853..02475eb 100644 --- a/src/odr-sourcecompanion.cpp +++ b/src/odr-sourcecompanion.cpp @@ -484,7 +484,19 @@ int main(int argc, char *argv[]) } else if (edi_output.enabled()) { edi_output.update_audio_levels(peak_left, peak_right); - success = edi_output.write_frame(outbuf.data(), numOutBytes); + // STI/EDI specifies that one AF packet must contain 24ms worth of data, + // therefore we must split the superframe into five parts + if (numOutBytes % 5 != 0) { + throw logic_error("Superframe size not multiple of 5"); + } + + const size_t blocksize = numOutBytes/5; + for (size_t i = 0; i < 5; i++) { + success = edi_output.write_frame(outbuf.data() + i * blocksize, blocksize); + if (not success) { + break; + } + } } if (not success) { |