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

Method OnCloseStream

src/brpc/policy/rtmp_protocol.cpp:2989–3017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2987}
2988
2989bool RtmpChunkStream::OnCloseStream(const RtmpMessageHeader& mh,
2990 AMFInputStream* istream,
2991 Socket* socket) {
2992 if (!connection_context()->is_server_side()) {
2993 RTMP_ERROR(socket, mh) << "Client should not receive `closeStream'";
2994 return false;
2995 }
2996 uint32_t transaction_id = 0;
2997 if (!ReadAMFUint32(&transaction_id, istream)) {
2998 RTMP_ERROR(socket, mh) << "Fail to read closeStream.TransactionId";
2999 return false;
3000 }
3001 if (!ReadAMFNull(istream)) { // command object
3002 RTMP_ERROR(socket, mh) << "Fail to read closeStream.CommandObject";
3003 return false;
3004 }
3005 butil::intrusive_ptr<RtmpStreamBase> stream;
3006 if (!connection_context()->FindMessageStream(mh.stream_id, &stream)) {
3007 // TODO: frequent, commented now
3008 //RTMP_WARNING(socket, mh) << "Fail to find stream_id=" << mh.stream_id;
3009 return false;
3010 }
3011 if (!stream->_paused) {
3012 stream->_paused = true;
3013 // TODO(gejun): Run in execq.
3014 static_cast<RtmpServerStream*>(stream.get())->OnPause(true, 0);
3015 }
3016 return true;
3017}
3018
3019class OnPublishContinuation : public google::protobuf::Closure {
3020public:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected