Re: [libav-devel] [PATCH 1/5] cbs_h2645: Return error if writing fails

2017-08-15 Thread Luca Barbato
On 15/08/2017 01:02, Mark Thompson wrote:
> ---
> The non-overflow case (noticed while writing similar code for MPEG-2).
> 
> 
>  libavcodec/cbs_h2645.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
> index 23556f47f..4d8ba99b3 100644
> --- a/libavcodec/cbs_h2645.c
> +++ b/libavcodec/cbs_h2645.c
> @@ -1244,6 +1244,11 @@ static int 
> cbs_h2645_write_nal_unit(CodedBitstreamContext *ctx,
>  // Overflow but we didn't notice.
>  av_assert0(put_bits_count() <= 8 * priv->write_buffer_size);
>  
> +if (err < 0) {
> +// Write failed for some other reason.
> +return err;
> +}
> +
>  if (put_bits_count() % 8)
>  unit->data_bit_padding = 8 - put_bits_count() % 8;
>  else
> 

Sure
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 1/5] cbs_h2645: Return error if writing fails

2017-08-14 Thread Mark Thompson
---
The non-overflow case (noticed while writing similar code for MPEG-2).


 libavcodec/cbs_h2645.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 23556f47f..4d8ba99b3 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1244,6 +1244,11 @@ static int 
cbs_h2645_write_nal_unit(CodedBitstreamContext *ctx,
 // Overflow but we didn't notice.
 av_assert0(put_bits_count() <= 8 * priv->write_buffer_size);
 
+if (err < 0) {
+// Write failed for some other reason.
+return err;
+}
+
 if (put_bits_count() % 8)
 unit->data_bit_padding = 8 - put_bits_count() % 8;
 else
-- 
2.11.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel