MCPcopy Create free account
hub / github.com/apache/brpc / AppendAndDestroySelf

Method AppendAndDestroySelf

src/brpc/policy/rtmp_protocol.cpp:787–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787butil::Status
788RtmpUnsentMessage::AppendAndDestroySelf(butil::IOBuf* out, Socket* s) {
789 std::unique_ptr<RtmpUnsentMessage> destroy_self(this);
790 if (s == NULL) { // abandoned
791 RPC_VLOG << "Socket=NULL";
792 return butil::Status::OK();
793 }
794 RtmpContext* ctx = static_cast<RtmpContext*>(s->parsing_context());
795 RtmpChunkStream* cstream = ctx->GetChunkStream(chunk_stream_id);
796 if (cstream == NULL) {
797 s->SetFailed(EINVAL, "Invalid chunk_stream_id=%u", chunk_stream_id);
798 return butil::Status(EINVAL, "Invalid chunk_stream_id=%u", chunk_stream_id);
799 }
800 if (cstream->SerializeMessage(out, header, &body) != 0) {
801 s->SetFailed(EINVAL, "Fail to serialize message");
802 return butil::Status(EINVAL, "Fail to serialize message");
803 }
804 if (new_chunk_size) {
805 ctx->_chunk_size_out = new_chunk_size;
806 }
807 if (!next) {
808 return butil::Status::OK();
809 }
810 RtmpUnsentMessage* p = next.release();
811 destroy_self.reset();
812 return p->AppendAndDestroySelf(out, s);
813}
814
815RtmpContext::SubChunkArray::SubChunkArray() {
816 memset(static_cast<void*>(ptrs), 0, sizeof(ptrs));

Callers 3

operator()Method · 0.45
SetupMethod · 0.45

Calls 15

WriteAMFStringFunction · 0.85
WriteAMFUint32Function · 0.85
RtmpPublishType2StrFunction · 0.85
WriteAMFObjectFunction · 0.85
WriteAMFNullFunction · 0.85
GetChunkStreamMethod · 0.80
SerializeMessageMethod · 0.80
descriptionMethod · 0.80
StatusEnum · 0.50
SetFailedMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected