diff mbox

[FFmpeg-devel] avformat/utils: log corrupt packets

Message ID 20191226145454.1685-1-ffmpeg@gyani.pro
State Superseded
Headers show

Commit Message

Gyan Doshi Dec. 26, 2019, 2:54 p.m. UTC
---
 libavformat/utils.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Andreas Rheinhardt Dec. 26, 2019, 3 p.m. UTC | #1
On Thu, Dec 26, 2019 at 3:55 PM Gyan Doshi <ffmpeg@gyani.pro> wrote:

> ---
>  libavformat/utils.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index b83a740500..7ac3920257 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -876,13 +876,16 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>          if (err < 0)
>              return err;
>
> -        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
> -            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
> +        if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
>              av_log(s, AV_LOG_WARNING,
> -                   "Dropped corrupted packet (stream = %d)\n",
> -                   pkt->stream_index);
> -            av_packet_unref(pkt);
> -            continue;
> +                   "Packet corrupt (stream = %d, dts = %s)",
> +                   pkt->stream_index, av_ts2str(pkt->pkt.dts));
>

pkt->pkt.dts? This shouldn't even compile.

- Andreas
Gyan Doshi Dec. 26, 2019, 3:33 p.m. UTC | #2
On 26-12-2019 08:30 pm, Andreas Rheinhardt wrote:
> On Thu, Dec 26, 2019 at 3:55 PM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>
>> ---
>>   libavformat/utils.c | 15 +++++++++------
>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index b83a740500..7ac3920257 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -876,13 +876,16 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>>           if (err < 0)
>>               return err;
>>
>> -        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
>> -            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
>> +        if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
>>               av_log(s, AV_LOG_WARNING,
>> -                   "Dropped corrupted packet (stream = %d)\n",
>> -                   pkt->stream_index);
>> -            av_packet_unref(pkt);
>> -            continue;
>> +                   "Packet corrupt (stream = %d, dts = %s)",
>> +                   pkt->stream_index, av_ts2str(pkt->pkt.dts));
>>
> pkt->pkt.dts? This shouldn't even compile.
Oops. Fixed and checked.

Thanks.
Gyan
Gyan Doshi Jan. 22, 2020, 6:24 a.m. UTC | #3
On 26-12-2019 09:03 pm, Gyan wrote:
>
>
> On 26-12-2019 08:30 pm, Andreas Rheinhardt wrote:
>> On Thu, Dec 26, 2019 at 3:55 PM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>>
>>> ---
>>>   libavformat/utils.c | 15 +++++++++------
>>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>>> index b83a740500..7ac3920257 100644
>>> --- a/libavformat/utils.c
>>> +++ b/libavformat/utils.c
>>> @@ -876,13 +876,16 @@ int ff_read_packet(AVFormatContext *s, 
>>> AVPacket *pkt)
>>>           if (err < 0)
>>>               return err;
>>>
>>> -        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
>>> -            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
>>> +        if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
>>>               av_log(s, AV_LOG_WARNING,
>>> -                   "Dropped corrupted packet (stream = %d)\n",
>>> -                   pkt->stream_index);
>>> -            av_packet_unref(pkt);
>>> -            continue;
>>> +                   "Packet corrupt (stream = %d, dts = %s)",
>>> +                   pkt->stream_index, av_ts2str(pkt->pkt.dts));
>>>
>> pkt->pkt.dts? This shouldn't even compile.
> Oops. Fixed and checked.

Will push tomorrow.

Gyan
Gyan Doshi Jan. 23, 2020, 7:01 a.m. UTC | #4
On 22-01-2020 11:54 am, Gyan wrote:
>
>
> On 26-12-2019 09:03 pm, Gyan wrote:
>>
>>
>> On 26-12-2019 08:30 pm, Andreas Rheinhardt wrote:
>>> On Thu, Dec 26, 2019 at 3:55 PM Gyan Doshi <ffmpeg@gyani.pro> wrote:
>>>
>>>> ---
>>>>   libavformat/utils.c | 15 +++++++++------
>>>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>>>> index b83a740500..7ac3920257 100644
>>>> --- a/libavformat/utils.c
>>>> +++ b/libavformat/utils.c
>>>> @@ -876,13 +876,16 @@ int ff_read_packet(AVFormatContext *s, 
>>>> AVPacket *pkt)
>>>>           if (err < 0)
>>>>               return err;
>>>>
>>>> -        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
>>>> -            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
>>>> +        if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
>>>>               av_log(s, AV_LOG_WARNING,
>>>> -                   "Dropped corrupted packet (stream = %d)\n",
>>>> -                   pkt->stream_index);
>>>> -            av_packet_unref(pkt);
>>>> -            continue;
>>>> +                   "Packet corrupt (stream = %d, dts = %s)",
>>>> +                   pkt->stream_index, av_ts2str(pkt->pkt.dts));
>>>>
>>> pkt->pkt.dts? This shouldn't even compile.
>> Oops. Fixed and checked.
>
> Will push tomorrow.

Pushed as 41f283ec7a2ee29c65b468c3d2c46d119dbb9071

Gyan
diff mbox

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index b83a740500..7ac3920257 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -876,13 +876,16 @@  int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (err < 0)
             return err;
 
-        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
-            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
+        if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
             av_log(s, AV_LOG_WARNING,
-                   "Dropped corrupted packet (stream = %d)\n",
-                   pkt->stream_index);
-            av_packet_unref(pkt);
-            continue;
+                   "Packet corrupt (stream = %d, dts = %s)",
+                   pkt->stream_index, av_ts2str(pkt->pkt.dts));
+            if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) {
+                av_log(s, AV_LOG_WARNING, ", dropping it.\n");
+                av_packet_unref(pkt);
+                continue;
+            }
+            av_log(s, AV_LOG_WARNING, ".\n");
         }
 
         if (pkt->stream_index >= (unsigned)s->nb_streams) {