sahvx655-wq commented on code in PR #3625:
URL: https://github.com/apache/brpc/pull/3625#discussion_r4335276762
##########
test/brpc_rtmp_unittest.cpp:
##########
@@ -1046,6 +1046,39 @@ TEST(RtmpTest, avc_seq_header_sps_exp_golomb) {
ASSERT_EQ(80, avc.height);
}
+// Create() stored lengthSizeMinusOne into the record before rejecting the
+// reserved value 2, so a rejected sequence header clobbered the field of a
+// record that had been parsed successfully before. TsWriter keeps muxing with
+// its record after a rejected header, and AVCNaluIterator then trips
+// CHECK_NE(_length_size_minus1, 2u) on the next video frame. A rejected
+// header must leave the record untouched.
Review Comment:
Right, the reorder only covered lengthSizeMinusOne. Going back through
Create() I count avc_profile and avc_level being overwritten up front, sps_list
cleared and partially refilled before the SPS-length and ParseSPS checks, and
pps_list cleared before the PPS checks, so a header that clears the
lengthSizeMinusOne check but is truncated after the SPS still leaves TsWriter
muxing with the new profile and an empty PPS list, which it then writes into
the TS output.
Took the first option: Create() now copies the record, runs the existing
body (moved verbatim into a private Parse()) on the copy, and assigns it back
only on success, so the reorder is gone and the record is untouched on every
error return. Starting from a copy rather than a fresh record keeps
width/height behaving as before when a header carries no SPS. The test now also
feeds a header with lengthSizeMinusOne=1 that stops before numPPS; against the
previous revision it fails on avc_profile (66 vs 77), and with this change it
passes along with the other 31 brpc_rtmp_unittest cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]