diff mbox

[FFmpeg-devel,1/6] cbs_h264: Fix handling of unknown SEI

Message ID 20180507231131.29840-1-sw@jkqxz.net
State Accepted
Commit 4c9741a1dddf8fd616da112a915413651d7ddd37
Headers show

Commit Message

Mark Thompson May 7, 2018, 11:11 p.m. UTC
The user should only interact directly with the data length, not the
payload size.
---
 libavcodec/cbs_h264_syntax_template.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Xiang, Haihao May 8, 2018, 4:02 a.m. UTC | #1
On Tue, 2018-05-08 at 00:11 +0100, Mark Thompson wrote:
> The user should only interact directly with the data length, not the

> payload size.

> ---

>  libavcodec/cbs_h264_syntax_template.c | 7 +++++--

>  1 file changed, 5 insertions(+), 2 deletions(-)

> 

> diff --git a/libavcodec/cbs_h264_syntax_template.c

> b/libavcodec/cbs_h264_syntax_template.c

> index 3ec4299915..b789207e33 100644

> --- a/libavcodec/cbs_h264_syntax_template.c

> +++ b/libavcodec/cbs_h264_syntax_template.c

> @@ -761,8 +761,11 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx,

> RWContext *rw,

>          break;

>      default:

>          {

> -            allocate(current->payload.other.data, current->payload_size);

> -            for (i = 0; i < current->payload_size; i++)

> +#ifdef READ

> +            current->payload.other.data_length = current->payload_size;

> +#endif

> +            allocate(current->payload.other.data, current-

> >payload.other.data_length);

> +            for (i = 0; i < current->payload.other.data_length; i++)

>                  xu(8, payload_byte[i], current->payload.other.data[i], 0,

> 255, 1, i);

>          }

>      }


LGTM, I will need to fix the H265 one as well.
diff mbox

Patch

diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 3ec4299915..b789207e33 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -761,8 +761,11 @@  static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
         break;
     default:
         {
-            allocate(current->payload.other.data, current->payload_size);
-            for (i = 0; i < current->payload_size; i++)
+#ifdef READ
+            current->payload.other.data_length = current->payload_size;
+#endif
+            allocate(current->payload.other.data, current->payload.other.data_length);
+            for (i = 0; i < current->payload.other.data_length; i++)
                 xu(8, payload_byte[i], current->payload.other.data[i], 0, 255, 1, i);
         }
     }