Unverified Commit 05d12419 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Add an option to skip packets with empty data (#6442)



Summary:
This diff adds **`skipOperationNotPermittedPackets`** to `DecoderParameters`.

Once that is set to `True`, it allows decoder to skip through those packets, that are causing `EPERM` errors and result into stoppage of consuming a stream.

Reviewed By: jdsgomes

Differential Revision: D38732706

fbshipit-source-id: a5cb64e14edda376e6ba240089ebee2e3a9865d0
Co-authored-by: default avatarOleksandr Voietsa <ovoietsa@fb.com>
parent cb5def22
......@@ -524,6 +524,13 @@ int Decoder::getFrame(size_t workingTimeInMs) {
VLOG(1) << "End of stream";
result = ENODATA;
break;
} else if (
result == AVERROR(EPERM) && params_.skipOperationNotPermittedPackets) {
// reset error, lets skip packets with EPERM
result = 0;
// reset the packet to default settings
av_packet_unref(avPacket);
continue;
} else if (result < 0) {
flushStreams();
LOG(ERROR) << "uuid=" << params_.loggingUuid
......@@ -590,7 +597,7 @@ int Decoder::getFrame(size_t workingTimeInMs) {
<< result;
// loop can be terminated, either by:
// 1. explcitly iterrupted
// 1. explicitly interrupted
// 3. unrecoverable error or ENODATA (end of stream) or ETIMEDOUT (timeout)
// 4. decoded frames pts are out of the specified range
// 5. success decoded frame
......
......@@ -210,6 +210,9 @@ struct DecoderParameters {
std::string tlsCertFile;
std::string tlsKeyFile;
// Skip packets that fail with EPERM errors and continue decoding.
bool skipOperationNotPermittedPackets{false};
};
struct DecoderHeader {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment