| 785 | } |
| 786 | |
| 787 | butil::Status |
| 788 | RtmpUnsentMessage::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 | |
| 815 | RtmpContext::SubChunkArray::SubChunkArray() { |
| 816 | memset(static_cast<void*>(ptrs), 0, sizeof(ptrs)); |
no test coverage detected