zyearn commented on a change in pull request #1505:
URL: https://github.com/apache/incubator-brpc/pull/1505#discussion_r683789006



##########
File path: src/brpc/rtmp.h
##########
@@ -402,6 +415,7 @@ class FlvWriter {
 
 private:
     bool _write_header;
+    char _header[9] = { 'F', 'L', 'V', 0x01, 0x05, 0, 0, 0, 0x09 };

Review comment:
       这里不需要把header全存下来,存option就可以,一是因为除了header[4]其余都是写死的,二是option以后可能还会扩展。

##########
File path: src/brpc/rtmp.cpp
##########
@@ -63,15 +63,19 @@ FlvWriter::FlvWriter(butil::IOBuf* buf)
     : _write_header(false), _buf(buf) {
 }
 
-static char g_flv_header[9] = { 'F', 'L', 'V', 0x01, 0x05, 0, 0, 0, 0x09 };
+FlvWriter::FlvWriter(butil::IOBuf* buf, const FlvWriterOptions& options)
+    : _write_header(false), _buf(buf) {
+    const int flags_bit_index = 4;
+    _header[flags_bit_index] = static_cast<uint8_t>(options.flv_content_type);
+}
 
 butil::Status FlvWriter::Write(const RtmpVideoMessage& msg) {

Review comment:
       char header[9] = { 'F', 'L', 'V', 0x01, _options.flv_content_type, 0, 0, 
0, 0x09 };




-- 
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]

Reply via email to