@@ -34,10 +34,10 @@ namespace roc {
34
34
namespace pipeline {
35
35
namespace test {
36
36
37
- // ! Generates and writes packets.
37
+ // Generates source and repair packets and pass them to destination writers
38
38
class PacketWriter : public core ::NonCopyable<> {
39
39
public:
40
- // ! Initialize without FEC.
40
+ // Initialize without FEC (produce only source packets)
41
41
PacketWriter (core::IArena& arena,
42
42
packet::IWriter& dst_writer,
43
43
rtp::FormatMap& format_map,
@@ -63,7 +63,7 @@ class PacketWriter : public core::NonCopyable<> {
63
63
packet::FEC_None, fec::WriterConfig ());
64
64
}
65
65
66
- // ! Initialize with FEC.
66
+ // Initialize with FEC (produce source + repair packets)
67
67
PacketWriter (core::IArena& arena,
68
68
packet::IWriter& source_dst_writer,
69
69
packet::IWriter& repair_dst_writer,
@@ -220,9 +220,12 @@ class PacketWriter : public core::NonCopyable<> {
220
220
void deliver_packet_ (const packet::PacketPtr& pp) {
221
221
if (fec_writer_) {
222
222
// fec_writer will produce source and repair packets and store in fec_queue
223
+ // note that we're calling copy_packet_() only after fec_writer, because
224
+ // fec writer normally lives in the middle of the pipeline and expects
225
+ // packets to have all necessary meta-information
223
226
fec_writer_->write (pp);
224
227
225
- // deliver produced packets
228
+ // compose and " deliver" source and repair packets produced by fec_writer
226
229
packet::PacketPtr fp;
227
230
while (fec_queue_.read (fp) == status::StatusOK) {
228
231
if (fp->has_flags (packet::Packet::FlagAudio)) {
@@ -234,14 +237,16 @@ class PacketWriter : public core::NonCopyable<> {
234
237
}
235
238
}
236
239
} else {
240
+ // compose and "deliver" packet
237
241
CHECK (source_composer_->compose (*pp));
238
242
source_writer_->write (copy_packet_ (pp));
239
243
}
240
244
}
241
245
242
- // creates a new packet with the same buffer, clearing all meta-information
243
- // like flags, parsed fields, etc; this way we simulate delivering packet
244
- // over network
246
+ // creates a new packet with the same buffer, without copying any meta-information
247
+ // like flags, parsed fields, etc; this way we simulate that packet was "delivered"
248
+ // over network - packets enters receiver's pipeline without any meta-information,
249
+ // and receiver fills that meta-information using packet parsers
245
250
packet::PacketPtr copy_packet_ (const packet::PacketPtr& pa) {
246
251
packet::PacketPtr pb = packet_factory_.new_packet ();
247
252
CHECK (pb);
0 commit comments