Skip to content
Snippets Groups Projects
Commit e72a1566 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Send I-frames for channel 2 also

parent bd2684b6
No related branches found
No related tags found
1 merge request!127Implements #196 stream capturing
Pipeline #15314 passed
This commit is part of merge request !127. Comments created here will be created in the context of that merge request.
...@@ -42,9 +42,10 @@ int main(int argc, char **argv) { ...@@ -42,9 +42,10 @@ int main(int argc, char **argv) {
LOG(INFO) << "Playing..."; LOG(INFO) << "Playing...";
int current_stream = 0; int current_stream = 0;
int current_channel = 0;
bool res = r.read(90000000000000, [&current_stream,&r](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { bool res = r.read(90000000000000, [&current_stream,&current_channel,&r](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
if (spkt.channel & 0x1 > 0) return; if (spkt.channel != current_channel) return;
if (spkt.streamID == current_stream) { if (spkt.streamID == current_stream) {
if (pkt.codec == codec_t::POSE) { if (pkt.codec == codec_t::POSE) {
...@@ -61,7 +62,7 @@ int main(int argc, char **argv) { ...@@ -61,7 +62,7 @@ int main(int argc, char **argv) {
LOG(INFO) << "Reading packet: (" << (int)spkt.streamID << "," << (int)spkt.channel << ") " << (int)pkt.codec << ", " << (int)pkt.definition; LOG(INFO) << "Reading packet: (" << (int)spkt.streamID << "," << (int)spkt.channel << ") " << (int)pkt.codec << ", " << (int)pkt.definition;
cv::Mat frame(cv::Size(ftl::codecs::getWidth(pkt.definition),ftl::codecs::getHeight(pkt.definition)), CV_8UC3); cv::Mat frame(cv::Size(ftl::codecs::getWidth(pkt.definition),ftl::codecs::getHeight(pkt.definition)), (spkt.channel == 1) ? CV_32F : CV_8UC3);
createDecoder(pkt); createDecoder(pkt);
try { try {
...@@ -78,6 +79,8 @@ int main(int argc, char **argv) { ...@@ -78,6 +79,8 @@ int main(int argc, char **argv) {
int key = cv::waitKey(20); int key = cv::waitKey(20);
if (key >= 48 && key <= 57) { if (key >= 48 && key <= 57) {
current_stream = key - 48; current_stream = key - 48;
} else if (key == 'd') {
current_channel = (current_channel == 0) ? 1 : 0;
} else if (key == 27) { } else if (key == 27) {
r.end(); r.end();
} }
......
...@@ -424,6 +424,7 @@ void Streamer::_process(ftl::rgbd::FrameSet &fs) { ...@@ -424,6 +424,7 @@ void Streamer::_process(ftl::rgbd::FrameSet &fs) {
// Receiver only waits for channel 1 by default // Receiver only waits for channel 1 by default
// TODO: Each encode could be done in own thread // TODO: Each encode could be done in own thread
if (hasChan2) { if (hasChan2) {
if (fs.timestamp % (10*ftl::timer::getInterval()) == 0) enc2->reset();
enc2->encode(fs.frames[j].get<cv::Mat>(fs.sources[j]->getChannel()), src->hq_bitrate, [this,src,hasChan2](const ftl::codecs::Packet &blk){ enc2->encode(fs.frames[j].get<cv::Mat>(fs.sources[j]->getChannel()), src->hq_bitrate, [this,src,hasChan2](const ftl::codecs::Packet &blk){
_transmitPacket(src, blk, 1, hasChan2, Quality::High); _transmitPacket(src, blk, 1, hasChan2, Quality::High);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment