Skip to content

Commit 78a702d

Browse files
committed
Modification based on comments
1 parent ae237c1 commit 78a702d

File tree

4 files changed

+179
-42
lines changed

4 files changed

+179
-42
lines changed

pjmedia/include/pjmedia/conference.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ typedef union pjmedia_conf_op_param
144144
* The information for connecting port operation.
145145
*/
146146
struct {
147-
unsigned src; /**< The source port id. For multiple port
148-
operation, this will be set to -1. */
149-
unsigned sink; /**< The destination port id. For multiple
150-
port operation, this will be set
151-
to -1. */
147+
unsigned src; /**< The source port id. */
148+
unsigned sink; /**< The destination port id. */
152149
int adj_level; /**< The adjustment level. */
153150
} connect_ports;
154151

pjsip/include/pjsua2/endpoint.hpp

Lines changed: 153 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,75 @@ struct OnRejectedIncomingCallParam
482482
SipRxData rdata;
483483
};
484484

485+
/**
486+
* This structure describes audio media's register/add of operation info.
487+
*/
488+
struct AudioMediaAddInfo
489+
{
490+
unsigned mediaId; /**< The media port id. */
491+
};
492+
493+
/**
494+
* This structure describes audio media's unregister/remove of operation info.
495+
*/
496+
struct AudioMediaRemoveInfo
497+
{
498+
unsigned mediaId; /**< The media port id. */
499+
};
500+
501+
/**
502+
* This structure describes an audio media's start transmit/connect operation
503+
* info.
504+
*/
505+
struct AudioMediaConnectInfo
506+
{
507+
unsigned mediaId; /**< The source media port id. */
508+
unsigned targetMediaId; /**< The destination media port id.*/
509+
int adjLevel; /**< The adjustment level. */
510+
};
511+
512+
/**
513+
* This structure describes an audio media's stop transmit/disconnect operation
514+
* info.
515+
*/
516+
struct AudioMediaDisconnectInfo
517+
{
518+
unsigned mediaId; /**< The source media port id.
519+
For multiple port operation,
520+
this will be set to - 1. */
521+
unsigned targetMediaId; /**< The destination media port id.
522+
For multiple port operation,
523+
this will be set to - 1. */
524+
};
525+
526+
/**
527+
* Audio media operation parameter.
528+
*/
529+
typedef union AudioMediaOpParam
530+
{
531+
/**
532+
* The information for adding audio media operation.
533+
*/
534+
AudioMediaAddInfo addInfo;
535+
536+
/**
537+
* The information for removing audio media operation.
538+
*/
539+
AudioMediaRemoveInfo removeInfo;
540+
541+
/**
542+
* The information for start transmitting/connecting audio media operation.
543+
*/
544+
AudioMediaConnectInfo connectInfo;
545+
546+
/**
547+
* The information for stop transmitting/disconnecting audio media
548+
* operation.
549+
*/
550+
AudioMediaDisconnectInfo disconnectInfo;
551+
552+
} AudioMediaOpParam;
553+
485554
/**
486555
* Parameter of Endpoint::onAudioMediaOpCompleted() callback.
487556
*/
@@ -497,17 +566,12 @@ struct OnAudioMediaOpCompletedParam {
497566
pj_status_t status;
498567

499568
/**
500-
* Represents the AudioMedia's port id associated with the operation.
501-
* The first port id will serves as the source port id for operations
502-
* involving destination AudioMedia. (e.g.: startTransmit/stopTransmit).
503-
*
504-
* The port id will be set to -1, to represents multiple source/destination
505-
* port.
569+
* The audio media operation information.
506570
*
507571
* App can use \a AudioMediaHelper to get the AudioMedia instance based on
508-
* the port id.
572+
* the audio media port id.
509573
*/
510-
UnsignedVector opData;
574+
AudioMediaOpParam opParam;
511575

512576
public:
513577
/**
@@ -516,33 +580,104 @@ struct OnAudioMediaOpCompletedParam {
516580
void fromPj(const pjmedia_conf_op_info &info);
517581
};
518582

583+
/**
584+
* This structure describes video media's register/add of operation info.
585+
*/
586+
struct VideoMediaAddInfo
587+
{
588+
unsigned mediaId; /**< The media port id. */
589+
};
590+
591+
/**
592+
* This structure describes video media's unregister/remove of operation info.
593+
*/
594+
struct VideoMediaRemoveInfo
595+
{
596+
unsigned mediaId; /**< The media port id. */
597+
};
598+
599+
/**
600+
* This structure describes an video media's start transmit/connect operation
601+
* info.
602+
*/
603+
struct VideoMediaConnectInfo
604+
{
605+
unsigned mediaId; /**< The source media port id. */
606+
unsigned targetMediaId; /**< The destination media port id.*/
607+
};
608+
609+
/**
610+
* This structure describes an video media's stop transmit/disconnect operation
611+
* info.
612+
*/
613+
struct VideoMediaDisconnectInfo
614+
{
615+
unsigned mediaId; /**< The source media port id. */
616+
unsigned targetMediaId; /**< The destination media port id.*/
617+
};
618+
619+
/**
620+
* This structure describes an video media's update operation info.
621+
*/
622+
struct VideoMediaUpdateInfo
623+
{
624+
unsigned mediaId; /**< The media port id. */
625+
};
626+
627+
/**
628+
* Video media operation parameter.
629+
*/
630+
typedef union VideoMediaOpParam
631+
{
632+
/**
633+
* The information for adding video media operation.
634+
*/
635+
VideoMediaAddInfo addInfo;
636+
637+
/**
638+
* The information for removing video media operation.
639+
*/
640+
VideoMediaRemoveInfo removeInfo;
641+
642+
/**
643+
* The information for start transmitting/connecting video media operation.
644+
*/
645+
VideoMediaConnectInfo connectInfo;
646+
647+
/**
648+
* The information for stop transmitting/disconnecting video media
649+
* operation.
650+
*/
651+
VideoMediaDisconnectInfo disconnectInfo;
652+
653+
/**
654+
* The information for updating video media operation.
655+
*/
656+
VideoMediaUpdateInfo updateInfo;
657+
658+
} VideoMediaOpParam;
659+
519660
/**
520661
* Parameter of Endpoint::onVideoMediaOpCompleted() callback.
521662
*/
522663
struct OnVideoMediaOpCompletedParam {
523664
/**
524-
* The Operation type.
665+
* The operation type.
525666
*/
526667
pjmedia_vid_conf_op_type opType;
527668

528669
/**
529670
* The operation status.
530671
*/
531-
pj_status_t status;
672+
pj_status_t status;
532673

533674
/**
534675
* Represents the VideoMedia's port id associated with the operation.
535-
* For operations involving source and destination VideoMedia instances
536-
* (e.g., startTransmit/stopTransmit), the first VideoMedia serves
537-
* as the source.
538676
*
539-
* The port id will be set to -1, to represents multiple source/destination
540-
* port.
541-
*
542677
* App can use \a VIdeoMediaHelper to get the VideoMedia instance based on
543-
* the port id.
678+
* the video media port id.
544679
*/
545-
UnsignedVector opData;
680+
VideoMediaOpParam opParam;
546681

547682
public:
548683
/**

pjsip/include/pjsua2/types.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ typedef std::vector<std::string> StringVector;
5252
/** Array of integers */
5353
typedef std::vector<int> IntVector;
5454

55-
/** Array of unsigned integers */
56-
typedef std::vector<unsigned> UnsignedVector;
57-
5855
/** Array of bytes */
5956
typedef std::vector<unsigned char> ByteVector;
6057

pjsip/src/pjsua2/endpoint.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,24 +251,26 @@ void OnAudioMediaOpCompletedParam::fromPj(const pjmedia_conf_op_info &info)
251251
switch (opType) {
252252
case PJMEDIA_CONF_OP_ADD_PORT:
253253
{
254-
opData.push_back(info.op_param.add_port.port);
254+
opParam.addInfo.mediaId = info.op_param.add_port.port;
255255
}
256256
break;
257257
case PJMEDIA_CONF_OP_REMOVE_PORT:
258258
{
259-
opData.push_back(info.op_param.remove_port.port);
259+
opParam.removeInfo.mediaId = info.op_param.remove_port.port;
260260
}
261261
break;
262262
case PJMEDIA_CONF_OP_CONNECT_PORTS:
263263
{
264-
opData.push_back(info.op_param.connect_ports.src);
265-
opData.push_back(info.op_param.connect_ports.sink);
264+
opParam.connectInfo.mediaId = info.op_param.connect_ports.src;
265+
opParam.connectInfo.targetMediaId = info.op_param.connect_ports.sink;
266+
opParam.connectInfo.adjLevel = info.op_param.connect_ports.adj_level;
266267
}
267268
break;
268269
case PJMEDIA_CONF_OP_DISCONNECT_PORTS:
269270
{
270-
opData.push_back(info.op_param.disconnect_ports.src);
271-
opData.push_back(info.op_param.disconnect_ports.sink);
271+
opParam.disconnectInfo.mediaId = info.op_param.disconnect_ports.src;
272+
opParam.disconnectInfo.targetMediaId =
273+
info.op_param.disconnect_ports.sink;
272274
}
273275
break;
274276
}
@@ -279,26 +281,32 @@ void OnVideoMediaOpCompletedParam::fromPj(const pjmedia_vid_conf_op_info &info)
279281
opType = info.op_type;
280282
status = info.status;
281283
switch (opType) {
282-
case PJMEDIA_CONF_OP_ADD_PORT:
284+
case PJMEDIA_VID_CONF_OP_ADD_PORT:
283285
{
284-
opData.push_back(info.op_param.add_port.port);
286+
opParam.addInfo.mediaId = info.op_param.add_port.port;
285287
}
286288
break;
287-
case PJMEDIA_CONF_OP_REMOVE_PORT:
289+
case PJMEDIA_VID_CONF_OP_REMOVE_PORT:
288290
{
289-
opData.push_back(info.op_param.remove_port.port);
291+
opParam.removeInfo.mediaId = info.op_param.remove_port.port;
290292
}
291293
break;
292-
case PJMEDIA_CONF_OP_CONNECT_PORTS:
294+
case PJMEDIA_VID_CONF_OP_CONNECT_PORTS:
293295
{
294-
opData.push_back(info.op_param.connect_ports.src);
295-
opData.push_back(info.op_param.connect_ports.sink);
296+
opParam.connectInfo.mediaId = info.op_param.connect_ports.src;
297+
opParam.connectInfo.targetMediaId = info.op_param.connect_ports.sink;
296298
}
297299
break;
298-
case PJMEDIA_CONF_OP_DISCONNECT_PORTS:
300+
case PJMEDIA_VID_CONF_OP_DISCONNECT_PORTS:
301+
{
302+
opParam.disconnectInfo.mediaId = info.op_param.disconnect_ports.src;
303+
opParam.disconnectInfo.targetMediaId =
304+
info.op_param.disconnect_ports.sink;
305+
}
306+
break;
307+
case PJMEDIA_VID_CONF_OP_UPDATE_PORT:
299308
{
300-
opData.push_back(info.op_param.disconnect_ports.src);
301-
opData.push_back(info.op_param.disconnect_ports.sink);
309+
opParam.updateInfo.mediaId = info.op_param.update_port.port;
302310
}
303311
break;
304312
}

0 commit comments

Comments
 (0)