Audio/video stream recording forums
|
Attention Visitor: |
You may have to register or log in before you can post:
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
librtmp RTMP_Read is block, can unblockdebug librtmp:
RTMP_Read-->Read_1_Packet-->RTMP_GetNextMediaPacket while (!bHasMediaPacket && RTMP_IsConnected(r) && RTMP_ReadPacket(r, packet)) { ... bHasMediaPacket = RTMP_ClientPacket(r, packet); if (!bHasMediaPacket) { RTMPPacket_Free(packet); } ... } there are be block。 can use callback do noblock: rtmp.h: typedef struct AVIOInterruptCB { int (*callback)(void*); void *opaque; } AVIOInterruptCB; typedef struct RTMP { ... AVIOInterruptCB interrupt_callback; ... } RTMP_Init: {.. r->interrupt_callback.opaque = NULL; r->interrupt_callback.callback = NULL; } outside use librtmp: static int decode_interrupt_cb(void *ctx) { MYClass *is = (MYClass *)ctx; return is->abort_request; } RTMP* r; RTMP_Init(r); r->interrupt_callback.callback = decode_interrupt_cb; r->interrupt_callback.opaque = this; if abort_request is true, RTMP_GetNextMediaPacket() break, RTMP_Read is break, can safe exit my application. I hope it can help you。 |
Tags: librtmp |
Thread Tools | |
Display Modes | |
|
|