Changeset 3893 for pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
- Timestamp:
- Dec 1, 2011 10:49:07 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
r3848 r3893 148 148 pj_uint32_t last_dec_ts; /**< Last decoded timestamp. */ 149 149 int last_dec_seq; /**< Last decoded sequence. */ 150 151 pjmedia_event_subscription esub_codec; /**< To subscribe codec events */152 pjmedia_event_publisher epub; /**< To publish events */153 150 }; 154 151 … … 340 337 * Handle events from stream components. 341 338 */ 342 static pj_status_t stream_event_cb(pjmedia_event _subscription *esub,343 pjmedia_event *event)344 { 345 pjmedia_vid_stream *stream = (pjmedia_vid_stream*) esub->user_data;346 347 if (e sub == &stream->esub_codec) {339 static pj_status_t stream_event_cb(pjmedia_event *event, 340 void *user_data) 341 { 342 pjmedia_vid_stream *stream = (pjmedia_vid_stream*)user_data; 343 344 if (event->epub == stream->codec) { 348 345 /* This is codec event */ 349 346 switch (event->type) { 350 347 case PJMEDIA_EVENT_FMT_CHANGED: 351 /* we process the event */352 ++event->proc_cnt;353 354 348 /* Copy the event to avoid deadlock if we publish the event 355 349 * now. This happens because fmt_event may trigger restart … … 363 357 } 364 358 365 return pjmedia_event_publish(&stream->epub, event); 366 } 367 368 static pjmedia_event_publisher *port_get_epub(pjmedia_port *port) 369 { 370 pjmedia_vid_stream *stream = (pjmedia_vid_stream*) port->port_data.pdata; 371 return &stream->epub; 359 return pjmedia_event_publish(NULL, stream, event, 0); 372 360 } 373 361 … … 1032 1020 1033 1021 /* Publish PJMEDIA_EVENT_FMT_CHANGED event */ 1034 if (pjmedia_event_publisher_has_sub(&stream->epub)){1022 { 1035 1023 pjmedia_event event; 1036 1024 … … 1038 1026 1039 1027 pjmedia_event_init(&event, PJMEDIA_EVENT_FMT_CHANGED, 1040 &frame->timestamp, &stream ->epub);1028 &frame->timestamp, &stream); 1041 1029 event.data.fmt_changed.dir = PJMEDIA_DIR_DECODING; 1042 1030 pj_memcpy(&event.data.fmt_changed.new_fmt, 1043 1031 &stream->info.codec_param->dec_fmt, 1044 1032 sizeof(pjmedia_format)); 1045 pjmedia_event_publish( &stream->epub, &event);1033 pjmedia_event_publish(NULL, stream, &event, 0); 1046 1034 } 1047 1035 } … … 1087 1075 "changed"); 1088 1076 1089 pjmedia_event_publish( &stream->epub, &stream->fmt_event);1077 pjmedia_event_publish(NULL, stream, &stream->fmt_event, 0); 1090 1078 1091 1079 stream->fmt_event.type = PJMEDIA_EVENT_NONE; … … 1212 1200 /* Init port. */ 1213 1201 channel->port.port_data.pdata = stream; 1214 channel->port.get_event_pub = &port_get_epub;1215 1202 1216 1203 PJ_LOG(5, (name.ptr, … … 1346 1333 return status; 1347 1334 1348 /* Init event publisher and subscribe to codec events */ 1349 pjmedia_event_publisher_init(&stream->epub, SIGNATURE); 1350 pjmedia_event_subscription_init(&stream->esub_codec, &stream_event_cb, 1351 stream); 1352 pjmedia_event_subscribe(&stream->codec->epub, &stream->esub_codec); 1335 /* Subscribe to codec events */ 1336 pjmedia_event_subscribe(NULL, pool, &stream_event_cb, stream, 1337 stream->codec); 1353 1338 1354 1339 /* Estimate the maximum frame size */ … … 1557 1542 /* Free codec. */ 1558 1543 if (stream->codec) { 1544 pjmedia_event_unsubscribe(NULL, &stream_event_cb, stream, 1545 stream->codec); 1559 1546 pjmedia_vid_codec_close(stream->codec); 1560 1547 pjmedia_vid_codec_mgr_dealloc_codec(stream->codec_mgr, stream->codec);
Note: See TracChangeset
for help on using the changeset viewer.