+ if (pkttype == RTMP_PT_NOTIFY) {
+ // For onMetaData and |RtmpSampleAccess packets, we want
+ // @setDataFrame prepended to the packet before it gets sent.
+ // However, definitely not *all* RTMP_PT_NOTIFY packets (e.g.,
+ // onTextData and onCuePoint).
+ uint8_t commandbuffer[64];
+ int stringlen = 0, commandsize = size - rt->flv_header_bytes;
+ GetByteContext gbc;
+
+ // buf_temp at this point should be pointing to the RTMP command
+ bytestream2_init(&gbc, buf_temp, commandsize);
+ if (ff_amf_read_string(&gbc, commandbuffer, sizeof(commandbuffer),
+ &stringlen))
+ return AVERROR_INVALIDDATA;
+
+ if (!strcmp(commandbuffer, "onMetaData") ||
+ !strcmp(commandbuffer, "|RtmpSampleAccess")) {
+ set_data_frame = 1;
+ }
+ }
+