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

Method Run

src/brpc/rtmp.cpp:2099–2132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2097};
2098
2099void OnClientStreamCreated::Run() {
2100 std::unique_ptr<OnClientStreamCreated> delete_self(this);
2101 if (cntl.Failed()) {
2102 LOG(WARNING) << "Fail to create stream=" << stream->rtmp_url()
2103 << ": " << cntl.ErrorText();
2104 return;
2105 }
2106 if (stream->_created_stream_with_play_or_publish) {
2107 // the server accepted the play/publish command packed in createStream
2108 return;
2109 }
2110 const RtmpClientStreamOptions& options = stream->options();
2111 bool do_nothing = true;
2112 if (!options.play_name.empty()) {
2113 do_nothing = false;
2114 RtmpPlayOptions play_opt;
2115 play_opt.stream_name = options.play_name;
2116 if (stream->Play(play_opt) != 0) {
2117 LOG(WARNING) << "Fail to play " << options.play_name;
2118 return stream->SignalError();
2119 }
2120 }
2121 if (!options.publish_name.empty()) {
2122 do_nothing = false;
2123 if (stream->Publish(options.publish_name, options.publish_type) != 0) {
2124 LOG(WARNING) << "Fail to publish " << stream->rtmp_url();
2125 return stream->SignalError();
2126 }
2127 }
2128 if (do_nothing) {
2129 LOG(ERROR) << "play_name and publish_name are both empty";
2130 return stream->SignalError();
2131 }
2132}
2133
2134void RtmpClientStream::Init(const RtmpClient* client,
2135 const RtmpClientStreamOptions& options) {

Callers 9

~ClosureGuardMethod · 0.45
resetMethod · 0.45
CallMethodMethod · 0.45
CallMethodMethod · 0.45
RunAsyncCallMethod · 0.45
RunOnFailedFunction · 0.45
NotifyOnStoppedMethod · 0.45
CallMethodMethod · 0.45
RunClosureFunction · 0.45

Calls 8

rtmp_urlMethod · 0.80
ErrorTextMethod · 0.80
optionsMethod · 0.80
PlayMethod · 0.80
SignalErrorMethod · 0.80
PublishMethod · 0.80
FailedMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected