@@ -127,7 +127,7 @@ srs_error_t SrsHttpHooks::on_publish(string url, SrsRequest* req)
127
127
128
128
SrsJsonObject* obj = SrsJsonAny::object ();
129
129
SrsAutoFree (SrsJsonObject, obj);
130
-
130
+
131
131
obj->set (" server_id" , SrsJsonAny::str (stat->server_id ().c_str ()));
132
132
obj->set (" action" , SrsJsonAny::str (" on_publish" ));
133
133
obj->set (" client_id" , SrsJsonAny::str (cid.c_str ()));
@@ -137,6 +137,12 @@ srs_error_t SrsHttpHooks::on_publish(string url, SrsRequest* req)
137
137
obj->set (" tcUrl" , SrsJsonAny::str (req->tcUrl .c_str ()));
138
138
obj->set (" stream" , SrsJsonAny::str (req->stream .c_str ()));
139
139
obj->set (" param" , SrsJsonAny::str (req->param .c_str ()));
140
+
141
+ obj->set (" stream_url" , SrsJsonAny::str (req->get_stream_url ().c_str ()));
142
+ SrsStatisticStream* stream = stat->find_stream_by_url (req->get_stream_url ());
143
+ if (stream) {
144
+ obj->set (" stream_id" , SrsJsonAny::str (stream->id .c_str ()));
145
+ }
140
146
141
147
std::string data = obj->dumps ();
142
148
std::string res;
@@ -171,8 +177,15 @@ void SrsHttpHooks::on_unpublish(string url, SrsRequest* req)
171
177
obj->set (" ip" , SrsJsonAny::str (req->ip .c_str ()));
172
178
obj->set (" vhost" , SrsJsonAny::str (req->vhost .c_str ()));
173
179
obj->set (" app" , SrsJsonAny::str (req->app .c_str ()));
180
+ obj->set (" tcUrl" , SrsJsonAny::str (req->tcUrl .c_str ()));
174
181
obj->set (" stream" , SrsJsonAny::str (req->stream .c_str ()));
175
182
obj->set (" param" , SrsJsonAny::str (req->param .c_str ()));
183
+
184
+ obj->set (" stream_url" , SrsJsonAny::str (req->get_stream_url ().c_str ()));
185
+ SrsStatisticStream* stream = stat->find_stream_by_url (req->get_stream_url ());
186
+ if (stream) {
187
+ obj->set (" stream_id" , SrsJsonAny::str (stream->id .c_str ()));
188
+ }
176
189
177
190
std::string data = obj->dumps ();
178
191
std::string res;
@@ -211,8 +224,15 @@ srs_error_t SrsHttpHooks::on_play(string url, SrsRequest* req)
211
224
obj->set (" vhost" , SrsJsonAny::str (req->vhost .c_str ()));
212
225
obj->set (" app" , SrsJsonAny::str (req->app .c_str ()));
213
226
obj->set (" stream" , SrsJsonAny::str (req->stream .c_str ()));
227
+ obj->set (" tcUrl" , SrsJsonAny::str (req->tcUrl .c_str ()));
214
228
obj->set (" param" , SrsJsonAny::str (req->param .c_str ()));
215
229
obj->set (" pageUrl" , SrsJsonAny::str (req->pageUrl .c_str ()));
230
+
231
+ obj->set (" stream_url" , SrsJsonAny::str (req->get_stream_url ().c_str ()));
232
+ SrsStatisticStream* stream = stat->find_stream_by_url (req->get_stream_url ());
233
+ if (stream) {
234
+ obj->set (" stream_id" , SrsJsonAny::str (stream->id .c_str ()));
235
+ }
216
236
217
237
std::string data = obj->dumps ();
218
238
std::string res;
@@ -247,8 +267,15 @@ void SrsHttpHooks::on_stop(string url, SrsRequest* req)
247
267
obj->set (" ip" , SrsJsonAny::str (req->ip .c_str ()));
248
268
obj->set (" vhost" , SrsJsonAny::str (req->vhost .c_str ()));
249
269
obj->set (" app" , SrsJsonAny::str (req->app .c_str ()));
270
+ obj->set (" tcUrl" , SrsJsonAny::str (req->tcUrl .c_str ()));
250
271
obj->set (" stream" , SrsJsonAny::str (req->stream .c_str ()));
251
272
obj->set (" param" , SrsJsonAny::str (req->param .c_str ()));
273
+
274
+ obj->set (" stream_url" , SrsJsonAny::str (req->get_stream_url ().c_str ()));
275
+ SrsStatisticStream* stream = stat->find_stream_by_url (req->get_stream_url ());
276
+ if (stream) {
277
+ obj->set (" stream_id" , SrsJsonAny::str (stream->id .c_str ()));
278
+ }
252
279
253
280
std::string data = obj->dumps ();
254
281
std::string res;
@@ -287,10 +314,17 @@ srs_error_t SrsHttpHooks::on_dvr(SrsContextId c, string url, SrsRequest* req, st
287
314
obj->set (" ip" , SrsJsonAny::str (req->ip .c_str ()));
288
315
obj->set (" vhost" , SrsJsonAny::str (req->vhost .c_str ()));
289
316
obj->set (" app" , SrsJsonAny::str (req->app .c_str ()));
317
+ obj->set (" tcUrl" , SrsJsonAny::str (req->tcUrl .c_str ()));
290
318
obj->set (" stream" , SrsJsonAny::str (req->stream .c_str ()));
291
319
obj->set (" param" , SrsJsonAny::str (req->param .c_str ()));
292
320
obj->set (" cwd" , SrsJsonAny::str (cwd.c_str ()));
293
321
obj->set (" file" , SrsJsonAny::str (file.c_str ()));
322
+
323
+ obj->set (" stream_url" , SrsJsonAny::str (req->get_stream_url ().c_str ()));
324
+ SrsStatisticStream* stream = stat->find_stream_by_url (req->get_stream_url ());
325
+ if (stream) {
326
+ obj->set (" stream_id" , SrsJsonAny::str (stream->id .c_str ()));
327
+ }
294
328
295
329
std::string data = obj->dumps ();
296
330
std::string res;
@@ -332,6 +366,7 @@ srs_error_t SrsHttpHooks::on_hls(SrsContextId c, string url, SrsRequest* req, st
332
366
obj->set (" ip" , SrsJsonAny::str (req->ip .c_str ()));
333
367
obj->set (" vhost" , SrsJsonAny::str (req->vhost .c_str ()));
334
368
obj->set (" app" , SrsJsonAny::str (req->app .c_str ()));
369
+ obj->set (" tcUrl" , SrsJsonAny::str (req->tcUrl .c_str ()));
335
370
obj->set (" stream" , SrsJsonAny::str (req->stream .c_str ()));
336
371
obj->set (" param" , SrsJsonAny::str (req->param .c_str ()));
337
372
obj->set (" duration" , SrsJsonAny::number (srsu2ms (duration)/1000.0 ));
@@ -341,6 +376,12 @@ srs_error_t SrsHttpHooks::on_hls(SrsContextId c, string url, SrsRequest* req, st
341
376
obj->set (" m3u8" , SrsJsonAny::str (m3u8.c_str ()));
342
377
obj->set (" m3u8_url" , SrsJsonAny::str (m3u8_url.c_str ()));
343
378
obj->set (" seq_no" , SrsJsonAny::integer (sn));
379
+
380
+ obj->set (" stream_url" , SrsJsonAny::str (req->get_stream_url ().c_str ()));
381
+ SrsStatisticStream* stream = stat->find_stream_by_url (req->get_stream_url ());
382
+ if (stream) {
383
+ obj->set (" stream_id" , SrsJsonAny::str (stream->id .c_str ()));
384
+ }
344
385
345
386
std::string data = obj->dumps ();
346
387
std::string res;
0 commit comments