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

Method OnPlay2

src/brpc/policy/rtmp_protocol.cpp:2925–2953  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2923}
2924
2925bool RtmpChunkStream::OnPlay2(const RtmpMessageHeader& mh,
2926 AMFInputStream* istream,
2927 Socket* socket) {
2928 if (!connection_context()->is_server_side()) {
2929 RTMP_ERROR(socket, mh) << "Client should not receive `play2'";
2930 return false;
2931 }
2932 uint32_t transaction_id = 0;
2933 if (!ReadAMFUint32(&transaction_id, istream)) {
2934 RTMP_ERROR(socket, mh) << "Fail to read play2.TransactionId";
2935 return false;
2936 }
2937 if (!ReadAMFNull(istream)) {
2938 RTMP_ERROR(socket, mh) << "Fail to read play2.CommandObject";
2939 return false;
2940 }
2941 RtmpPlay2Options play2_options;
2942 if (!ReadAMFObject(&play2_options, istream)) {
2943 RTMP_ERROR(socket, mh) << "Fail to read play2.Parameters";
2944 return false;
2945 }
2946 butil::intrusive_ptr<RtmpStreamBase> stream;
2947 if (!connection_context()->FindMessageStream(mh.stream_id, &stream)) {
2948 RTMP_WARNING(socket, mh) << "Fail to find stream_id=" << mh.stream_id;
2949 return false;
2950 }
2951 static_cast<RtmpServerStream*>(stream.get())->OnPlay2(play2_options);
2952 return true;
2953}
2954
2955bool RtmpChunkStream::OnDeleteStream(const RtmpMessageHeader& mh,
2956 AMFInputStream* istream,

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected