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

Method OnDeleteStream

src/brpc/policy/rtmp_protocol.cpp:2955–2987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2953}
2954
2955bool RtmpChunkStream::OnDeleteStream(const RtmpMessageHeader& mh,
2956 AMFInputStream* istream,
2957 Socket* socket) {
2958 if (!connection_context()->is_server_side()) {
2959 RTMP_ERROR(socket, mh) << "Client should not receive `deleteStream'";
2960 return false;
2961 }
2962 uint32_t transaction_id = 0;
2963 if (!ReadAMFUint32(&transaction_id, istream)) {
2964 RTMP_ERROR(socket, mh) << "Fail to read deleteStream.TransactionId";
2965 return false;
2966 }
2967 if (!ReadAMFNull(istream)) { // command object
2968 RTMP_ERROR(socket, mh) << "Fail to read deleteStream.CommandObject";
2969 return false;
2970 }
2971 uint32_t stream_id = 0;
2972 if (!ReadAMFUint32(&stream_id, istream)) {
2973 RTMP_ERROR(socket, mh) << "Fail to read deleteStream.StreamId";
2974 return false;
2975 }
2976 butil::intrusive_ptr<RtmpStreamBase> stream;
2977 if (!connection_context()->FindMessageStream(stream_id, &stream)) {
2978 // TODO: frequent, commented now
2979 //RTMP_WARNING(socket, mh) << "Fail to find stream_id=" << stream_id;
2980 return false;
2981 }
2982 bthread_id_t id = static_cast<RtmpServerStream*>(stream.get())->_onfail_id;
2983 if (id != INVALID_BTHREAD_ID) {
2984 bthread_id_error(id, 0);
2985 }
2986 return true;
2987}
2988
2989bool RtmpChunkStream::OnCloseStream(const RtmpMessageHeader& mh,
2990 AMFInputStream* istream,

Callers

nothing calls this directly

Calls 5

ReadAMFUint32Function · 0.85
ReadAMFNullFunction · 0.85
FindMessageStreamMethod · 0.80
is_server_sideMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected