refine RTMP protocol stack, refine the packet encode/decode, remove class_name
正在显示
2 个修改的文件
包含
109 行增加
和
222 行删除
| @@ -447,8 +447,7 @@ int SrsProtocol::do_send_message(SrsMessage* msg, SrsPacket* packet) | @@ -447,8 +447,7 @@ int SrsProtocol::do_send_message(SrsMessage* msg, SrsPacket* packet) | ||
| 447 | // we donot use the complex basic header, | 447 | // we donot use the complex basic header, |
| 448 | // ensure the basic header is 1bytes. | 448 | // ensure the basic header is 1bytes. |
| 449 | if (msg->header.perfer_cid < 2) { | 449 | if (msg->header.perfer_cid < 2) { |
| 450 | - srs_warn("change the chunk_id=%d to default=%d", | ||
| 451 | - msg->header.perfer_cid, RTMP_CID_ProtocolControl); | 450 | + srs_warn("change the chunk_id=%d to default=%d", msg->header.perfer_cid, RTMP_CID_ProtocolControl); |
| 452 | msg->header.perfer_cid = RTMP_CID_ProtocolControl; | 451 | msg->header.perfer_cid = RTMP_CID_ProtocolControl; |
| 453 | } | 452 | } |
| 454 | 453 | ||
| @@ -1689,29 +1688,6 @@ SrsPacket::~SrsPacket() | @@ -1689,29 +1688,6 @@ SrsPacket::~SrsPacket() | ||
| 1689 | { | 1688 | { |
| 1690 | } | 1689 | } |
| 1691 | 1690 | ||
| 1692 | -int SrsPacket::decode(SrsStream* stream) | ||
| 1693 | -{ | ||
| 1694 | - int ret = ERROR_SUCCESS; | ||
| 1695 | - | ||
| 1696 | - srs_assert(stream != NULL); | ||
| 1697 | - | ||
| 1698 | - ret = ERROR_SYSTEM_PACKET_INVALID; | ||
| 1699 | - srs_error("current packet is not support to decode. " | ||
| 1700 | - "paket=%s, ret=%d", get_class_name(), ret); | ||
| 1701 | - | ||
| 1702 | - return ret; | ||
| 1703 | -} | ||
| 1704 | - | ||
| 1705 | -int SrsPacket::get_perfer_cid() | ||
| 1706 | -{ | ||
| 1707 | - return 0; | ||
| 1708 | -} | ||
| 1709 | - | ||
| 1710 | -int SrsPacket::get_message_type() | ||
| 1711 | -{ | ||
| 1712 | - return 0; | ||
| 1713 | -} | ||
| 1714 | - | ||
| 1715 | int SrsPacket::encode(int& psize, char*& ppayload) | 1691 | int SrsPacket::encode(int& psize, char*& ppayload) |
| 1716 | { | 1692 | { |
| 1717 | int ret = ERROR_SUCCESS; | 1693 | int ret = ERROR_SUCCESS; |
| @@ -1744,6 +1720,28 @@ int SrsPacket::encode(int& psize, char*& ppayload) | @@ -1744,6 +1720,28 @@ int SrsPacket::encode(int& psize, char*& ppayload) | ||
| 1744 | return ret; | 1720 | return ret; |
| 1745 | } | 1721 | } |
| 1746 | 1722 | ||
| 1723 | +int SrsPacket::decode(SrsStream* stream) | ||
| 1724 | +{ | ||
| 1725 | + int ret = ERROR_SUCCESS; | ||
| 1726 | + | ||
| 1727 | + srs_assert(stream != NULL); | ||
| 1728 | + | ||
| 1729 | + ret = ERROR_SYSTEM_PACKET_INVALID; | ||
| 1730 | + srs_error("current packet is not support to decode. ret=%d", ret); | ||
| 1731 | + | ||
| 1732 | + return ret; | ||
| 1733 | +} | ||
| 1734 | + | ||
| 1735 | +int SrsPacket::get_perfer_cid() | ||
| 1736 | +{ | ||
| 1737 | + return 0; | ||
| 1738 | +} | ||
| 1739 | + | ||
| 1740 | +int SrsPacket::get_message_type() | ||
| 1741 | +{ | ||
| 1742 | + return 0; | ||
| 1743 | +} | ||
| 1744 | + | ||
| 1747 | int SrsPacket::get_size() | 1745 | int SrsPacket::get_size() |
| 1748 | { | 1746 | { |
| 1749 | return 0; | 1747 | return 0; |
| @@ -1756,8 +1754,7 @@ int SrsPacket::encode_packet(SrsStream* stream) | @@ -1756,8 +1754,7 @@ int SrsPacket::encode_packet(SrsStream* stream) | ||
| 1756 | srs_assert(stream != NULL); | 1754 | srs_assert(stream != NULL); |
| 1757 | 1755 | ||
| 1758 | ret = ERROR_SYSTEM_PACKET_INVALID; | 1756 | ret = ERROR_SYSTEM_PACKET_INVALID; |
| 1759 | - srs_error("current packet is not support to encode. " | ||
| 1760 | - "paket=%s, ret=%d", get_class_name(), ret); | 1757 | + srs_error("current packet is not support to encode. ret=%d", ret); |
| 1761 | 1758 | ||
| 1762 | return ret; | 1759 | return ret; |
| 1763 | } | 1760 | } |
| @@ -3141,6 +3138,32 @@ SrsBandwidthPacket::~SrsBandwidthPacket() | @@ -3141,6 +3138,32 @@ SrsBandwidthPacket::~SrsBandwidthPacket() | ||
| 3141 | srs_freep(data); | 3138 | srs_freep(data); |
| 3142 | } | 3139 | } |
| 3143 | 3140 | ||
| 3141 | +int SrsBandwidthPacket::decode(SrsStream *stream) | ||
| 3142 | +{ | ||
| 3143 | + int ret = ERROR_SUCCESS; | ||
| 3144 | + | ||
| 3145 | + if ((ret = srs_amf0_read_string(stream, command_name)) != ERROR_SUCCESS) { | ||
| 3146 | + srs_error("amf0 decode play command_name failed. ret=%d", ret); | ||
| 3147 | + return ret; | ||
| 3148 | + } | ||
| 3149 | + | ||
| 3150 | + if ((ret = srs_amf0_read_number(stream, transaction_id)) != ERROR_SUCCESS) { | ||
| 3151 | + srs_error("amf0 decode play transaction_id failed. ret=%d", ret); | ||
| 3152 | + return ret; | ||
| 3153 | + } | ||
| 3154 | + | ||
| 3155 | + if ((ret = srs_amf0_read_null(stream)) != ERROR_SUCCESS) { | ||
| 3156 | + srs_error("amf0 decode play command_object failed. ret=%d", ret); | ||
| 3157 | + return ret; | ||
| 3158 | + } | ||
| 3159 | + | ||
| 3160 | + // @remark, for bandwidth test, ignore the data field. | ||
| 3161 | + | ||
| 3162 | + srs_info("decode SrsBandwidthPacket success."); | ||
| 3163 | + | ||
| 3164 | + return ret; | ||
| 3165 | +} | ||
| 3166 | + | ||
| 3144 | int SrsBandwidthPacket::get_perfer_cid() | 3167 | int SrsBandwidthPacket::get_perfer_cid() |
| 3145 | { | 3168 | { |
| 3146 | return RTMP_CID_OverStream; | 3169 | return RTMP_CID_OverStream; |
| @@ -3190,32 +3213,6 @@ int SrsBandwidthPacket::encode_packet(SrsStream* stream) | @@ -3190,32 +3213,6 @@ int SrsBandwidthPacket::encode_packet(SrsStream* stream) | ||
| 3190 | return ret; | 3213 | return ret; |
| 3191 | } | 3214 | } |
| 3192 | 3215 | ||
| 3193 | -int SrsBandwidthPacket::decode(SrsStream *stream) | ||
| 3194 | -{ | ||
| 3195 | - int ret = ERROR_SUCCESS; | ||
| 3196 | - | ||
| 3197 | - if ((ret = srs_amf0_read_string(stream, command_name)) != ERROR_SUCCESS) { | ||
| 3198 | - srs_error("amf0 decode play command_name failed. ret=%d", ret); | ||
| 3199 | - return ret; | ||
| 3200 | - } | ||
| 3201 | - | ||
| 3202 | - if ((ret = srs_amf0_read_number(stream, transaction_id)) != ERROR_SUCCESS) { | ||
| 3203 | - srs_error("amf0 decode play transaction_id failed. ret=%d", ret); | ||
| 3204 | - return ret; | ||
| 3205 | - } | ||
| 3206 | - | ||
| 3207 | - if ((ret = srs_amf0_read_null(stream)) != ERROR_SUCCESS) { | ||
| 3208 | - srs_error("amf0 decode play command_object failed. ret=%d", ret); | ||
| 3209 | - return ret; | ||
| 3210 | - } | ||
| 3211 | - | ||
| 3212 | - // @remark, for bandwidth test, ignore the data field. | ||
| 3213 | - | ||
| 3214 | - srs_info("decode SrsBandwidthPacket success."); | ||
| 3215 | - | ||
| 3216 | - return ret; | ||
| 3217 | -} | ||
| 3218 | - | ||
| 3219 | bool SrsBandwidthPacket::is_starting_play() | 3216 | bool SrsBandwidthPacket::is_starting_play() |
| 3220 | { | 3217 | { |
| 3221 | return command_name == SRS_BW_CHECK_STARTING_PLAY; | 3218 | return command_name == SRS_BW_CHECK_STARTING_PLAY; |
| @@ -62,9 +62,6 @@ class SrsChunkStream; | @@ -62,9 +62,6 @@ class SrsChunkStream; | ||
| 62 | // generally, it's the pulse time for data seding. | 62 | // generally, it's the pulse time for data seding. |
| 63 | #define SRS_PULSE_TIMEOUT_US (int64_t)(200*1000LL) | 63 | #define SRS_PULSE_TIMEOUT_US (int64_t)(200*1000LL) |
| 64 | 64 | ||
| 65 | -// convert class name to string. | ||
| 66 | -#define CLASS_NAME_STRING(className) #className | ||
| 67 | - | ||
| 68 | /** | 65 | /** |
| 69 | * max rtmp header size: | 66 | * max rtmp header size: |
| 70 | * 1bytes basic header, | 67 | * 1bytes basic header, |
| @@ -435,43 +432,38 @@ public: | @@ -435,43 +432,38 @@ public: | ||
| 435 | */ | 432 | */ |
| 436 | class SrsPacket | 433 | class SrsPacket |
| 437 | { | 434 | { |
| 438 | -protected: | ||
| 439 | - /** | ||
| 440 | - * subpacket must override to provide the right class name. | ||
| 441 | - */ | ||
| 442 | - virtual const char* get_class_name() | ||
| 443 | - { | ||
| 444 | - return CLASS_NAME_STRING(SrsPacket); | ||
| 445 | - } | ||
| 446 | public: | 435 | public: |
| 447 | SrsPacket(); | 436 | SrsPacket(); |
| 448 | virtual ~SrsPacket(); | 437 | virtual ~SrsPacket(); |
| 449 | -/** | ||
| 450 | -* decode functions. | ||
| 451 | -*/ | 438 | +public: |
| 439 | + /** | ||
| 440 | + * the subpacket can override this encode, | ||
| 441 | + * for example, video and audio will directly set the payload withou memory copy, | ||
| 442 | + * other packet which need to serialize/encode to bytes by override the | ||
| 443 | + * get_size and encode_packet. | ||
| 444 | + */ | ||
| 445 | + virtual int encode(int& size, char*& payload); | ||
| 446 | +// decode functions for concrete packet to override. | ||
| 452 | public: | 447 | public: |
| 453 | /** | 448 | /** |
| 454 | * subpacket must override to decode packet from stream. | 449 | * subpacket must override to decode packet from stream. |
| 455 | * @remark never invoke the super.decode, it always failed. | 450 | * @remark never invoke the super.decode, it always failed. |
| 456 | */ | 451 | */ |
| 457 | virtual int decode(SrsStream* stream); | 452 | virtual int decode(SrsStream* stream); |
| 458 | -/** | ||
| 459 | -* encode functions. | ||
| 460 | -*/ | 453 | +// encode functions for concrete packet to override. |
| 461 | public: | 454 | public: |
| 455 | + /** | ||
| 456 | + * the cid(chunk id) specifies the chunk to send data over. | ||
| 457 | + * generally, each message perfer some cid, for example, | ||
| 458 | + * all protocol control messages perfer RTMP_CID_ProtocolControl, | ||
| 459 | + * SrsSetWindowAckSizePacket is protocol control message. | ||
| 460 | + */ | ||
| 462 | virtual int get_perfer_cid(); | 461 | virtual int get_perfer_cid(); |
| 463 | -public: | ||
| 464 | /** | 462 | /** |
| 465 | * subpacket must override to provide the right message type. | 463 | * subpacket must override to provide the right message type. |
| 464 | + * the message type set the RTMP message type in header. | ||
| 466 | */ | 465 | */ |
| 467 | virtual int get_message_type(); | 466 | virtual int get_message_type(); |
| 468 | - /** | ||
| 469 | - * the subpacket can override this encode, | ||
| 470 | - * for example, video and audio will directly set the payload withou memory copy, | ||
| 471 | - * other packet which need to serialize/encode to bytes by override the | ||
| 472 | - * get_size and encode_packet. | ||
| 473 | - */ | ||
| 474 | - virtual int encode(int& size, char*& payload); | ||
| 475 | protected: | 467 | protected: |
| 476 | /** | 468 | /** |
| 477 | * subpacket can override to calc the packet size. | 469 | * subpacket can override to calc the packet size. |
| @@ -491,11 +483,6 @@ protected: | @@ -491,11 +483,6 @@ protected: | ||
| 491 | */ | 483 | */ |
| 492 | class SrsConnectAppPacket : public SrsPacket | 484 | class SrsConnectAppPacket : public SrsPacket |
| 493 | { | 485 | { |
| 494 | -protected: | ||
| 495 | - virtual const char* get_class_name() | ||
| 496 | - { | ||
| 497 | - return CLASS_NAME_STRING(SrsConnectAppPacket); | ||
| 498 | - } | ||
| 499 | public: | 486 | public: |
| 500 | std::string command_name; | 487 | std::string command_name; |
| 501 | double transaction_id; | 488 | double transaction_id; |
| @@ -512,11 +499,12 @@ public: | @@ -512,11 +499,12 @@ public: | ||
| 512 | public: | 499 | public: |
| 513 | SrsConnectAppPacket(); | 500 | SrsConnectAppPacket(); |
| 514 | virtual ~SrsConnectAppPacket(); | 501 | virtual ~SrsConnectAppPacket(); |
| 502 | +// decode functions for concrete packet to override. | ||
| 515 | public: | 503 | public: |
| 516 | virtual int decode(SrsStream* stream); | 504 | virtual int decode(SrsStream* stream); |
| 505 | +// encode functions for concrete packet to override. | ||
| 517 | public: | 506 | public: |
| 518 | virtual int get_perfer_cid(); | 507 | virtual int get_perfer_cid(); |
| 519 | -public: | ||
| 520 | virtual int get_message_type(); | 508 | virtual int get_message_type(); |
| 521 | protected: | 509 | protected: |
| 522 | virtual int get_size(); | 510 | virtual int get_size(); |
| @@ -527,11 +515,6 @@ protected: | @@ -527,11 +515,6 @@ protected: | ||
| 527 | */ | 515 | */ |
| 528 | class SrsConnectAppResPacket : public SrsPacket | 516 | class SrsConnectAppResPacket : public SrsPacket |
| 529 | { | 517 | { |
| 530 | -protected: | ||
| 531 | - virtual const char* get_class_name() | ||
| 532 | - { | ||
| 533 | - return CLASS_NAME_STRING(SrsConnectAppResPacket); | ||
| 534 | - } | ||
| 535 | public: | 518 | public: |
| 536 | std::string command_name; | 519 | std::string command_name; |
| 537 | double transaction_id; | 520 | double transaction_id; |
| @@ -540,11 +523,12 @@ public: | @@ -540,11 +523,12 @@ public: | ||
| 540 | public: | 523 | public: |
| 541 | SrsConnectAppResPacket(); | 524 | SrsConnectAppResPacket(); |
| 542 | virtual ~SrsConnectAppResPacket(); | 525 | virtual ~SrsConnectAppResPacket(); |
| 526 | +// decode functions for concrete packet to override. | ||
| 543 | public: | 527 | public: |
| 544 | virtual int decode(SrsStream* stream); | 528 | virtual int decode(SrsStream* stream); |
| 529 | +// encode functions for concrete packet to override. | ||
| 545 | public: | 530 | public: |
| 546 | virtual int get_perfer_cid(); | 531 | virtual int get_perfer_cid(); |
| 547 | -public: | ||
| 548 | virtual int get_message_type(); | 532 | virtual int get_message_type(); |
| 549 | protected: | 533 | protected: |
| 550 | virtual int get_size(); | 534 | virtual int get_size(); |
| @@ -559,11 +543,6 @@ protected: | @@ -559,11 +543,6 @@ protected: | ||
| 559 | */ | 543 | */ |
| 560 | class SrsCallPacket : public SrsPacket | 544 | class SrsCallPacket : public SrsPacket |
| 561 | { | 545 | { |
| 562 | -protected: | ||
| 563 | - virtual const char* get_class_name() | ||
| 564 | - { | ||
| 565 | - return CLASS_NAME_STRING(SrsCallPacket); | ||
| 566 | - } | ||
| 567 | public: | 546 | public: |
| 568 | std::string command_name; | 547 | std::string command_name; |
| 569 | double transaction_id; | 548 | double transaction_id; |
| @@ -577,11 +556,12 @@ public: | @@ -577,11 +556,12 @@ public: | ||
| 577 | public: | 556 | public: |
| 578 | SrsCallPacket(); | 557 | SrsCallPacket(); |
| 579 | virtual ~SrsCallPacket(); | 558 | virtual ~SrsCallPacket(); |
| 559 | +// decode functions for concrete packet to override. | ||
| 580 | public: | 560 | public: |
| 581 | virtual int decode(SrsStream* stream); | 561 | virtual int decode(SrsStream* stream); |
| 562 | +// encode functions for concrete packet to override. | ||
| 582 | public: | 563 | public: |
| 583 | virtual int get_perfer_cid(); | 564 | virtual int get_perfer_cid(); |
| 584 | -public: | ||
| 585 | virtual int get_message_type(); | 565 | virtual int get_message_type(); |
| 586 | protected: | 566 | protected: |
| 587 | virtual int get_size(); | 567 | virtual int get_size(); |
| @@ -592,11 +572,6 @@ protected: | @@ -592,11 +572,6 @@ protected: | ||
| 592 | */ | 572 | */ |
| 593 | class SrsCallResPacket : public SrsPacket | 573 | class SrsCallResPacket : public SrsPacket |
| 594 | { | 574 | { |
| 595 | -protected: | ||
| 596 | - virtual const char* get_class_name() | ||
| 597 | - { | ||
| 598 | - return CLASS_NAME_STRING(SrsCallResPacket); | ||
| 599 | - } | ||
| 600 | public: | 575 | public: |
| 601 | std::string command_name; | 576 | std::string command_name; |
| 602 | double transaction_id; | 577 | double transaction_id; |
| @@ -609,9 +584,9 @@ public: | @@ -609,9 +584,9 @@ public: | ||
| 609 | public: | 584 | public: |
| 610 | SrsCallResPacket(double _transaction_id); | 585 | SrsCallResPacket(double _transaction_id); |
| 611 | virtual ~SrsCallResPacket(); | 586 | virtual ~SrsCallResPacket(); |
| 587 | +// encode functions for concrete packet to override. | ||
| 612 | public: | 588 | public: |
| 613 | virtual int get_perfer_cid(); | 589 | virtual int get_perfer_cid(); |
| 614 | -public: | ||
| 615 | virtual int get_message_type(); | 590 | virtual int get_message_type(); |
| 616 | protected: | 591 | protected: |
| 617 | virtual int get_size(); | 592 | virtual int get_size(); |
| @@ -627,11 +602,6 @@ protected: | @@ -627,11 +602,6 @@ protected: | ||
| 627 | */ | 602 | */ |
| 628 | class SrsCreateStreamPacket : public SrsPacket | 603 | class SrsCreateStreamPacket : public SrsPacket |
| 629 | { | 604 | { |
| 630 | -protected: | ||
| 631 | - virtual const char* get_class_name() | ||
| 632 | - { | ||
| 633 | - return CLASS_NAME_STRING(SrsCreateStreamPacket); | ||
| 634 | - } | ||
| 635 | public: | 605 | public: |
| 636 | std::string command_name; | 606 | std::string command_name; |
| 637 | double transaction_id; | 607 | double transaction_id; |
| @@ -639,11 +609,12 @@ public: | @@ -639,11 +609,12 @@ public: | ||
| 639 | public: | 609 | public: |
| 640 | SrsCreateStreamPacket(); | 610 | SrsCreateStreamPacket(); |
| 641 | virtual ~SrsCreateStreamPacket(); | 611 | virtual ~SrsCreateStreamPacket(); |
| 612 | +// decode functions for concrete packet to override. | ||
| 642 | public: | 613 | public: |
| 643 | virtual int decode(SrsStream* stream); | 614 | virtual int decode(SrsStream* stream); |
| 615 | +// encode functions for concrete packet to override. | ||
| 644 | public: | 616 | public: |
| 645 | virtual int get_perfer_cid(); | 617 | virtual int get_perfer_cid(); |
| 646 | -public: | ||
| 647 | virtual int get_message_type(); | 618 | virtual int get_message_type(); |
| 648 | protected: | 619 | protected: |
| 649 | virtual int get_size(); | 620 | virtual int get_size(); |
| @@ -654,11 +625,6 @@ protected: | @@ -654,11 +625,6 @@ protected: | ||
| 654 | */ | 625 | */ |
| 655 | class SrsCreateStreamResPacket : public SrsPacket | 626 | class SrsCreateStreamResPacket : public SrsPacket |
| 656 | { | 627 | { |
| 657 | -protected: | ||
| 658 | - virtual const char* get_class_name() | ||
| 659 | - { | ||
| 660 | - return CLASS_NAME_STRING(SrsCreateStreamResPacket); | ||
| 661 | - } | ||
| 662 | public: | 628 | public: |
| 663 | std::string command_name; | 629 | std::string command_name; |
| 664 | double transaction_id; | 630 | double transaction_id; |
| @@ -667,11 +633,12 @@ public: | @@ -667,11 +633,12 @@ public: | ||
| 667 | public: | 633 | public: |
| 668 | SrsCreateStreamResPacket(double _transaction_id, double _stream_id); | 634 | SrsCreateStreamResPacket(double _transaction_id, double _stream_id); |
| 669 | virtual ~SrsCreateStreamResPacket(); | 635 | virtual ~SrsCreateStreamResPacket(); |
| 636 | +// decode functions for concrete packet to override. | ||
| 670 | public: | 637 | public: |
| 671 | virtual int decode(SrsStream* stream); | 638 | virtual int decode(SrsStream* stream); |
| 639 | +// encode functions for concrete packet to override. | ||
| 672 | public: | 640 | public: |
| 673 | virtual int get_perfer_cid(); | 641 | virtual int get_perfer_cid(); |
| 674 | -public: | ||
| 675 | virtual int get_message_type(); | 642 | virtual int get_message_type(); |
| 676 | protected: | 643 | protected: |
| 677 | virtual int get_size(); | 644 | virtual int get_size(); |
| @@ -683,11 +650,6 @@ protected: | @@ -683,11 +650,6 @@ protected: | ||
| 683 | */ | 650 | */ |
| 684 | class SrsCloseStreamPacket : public SrsPacket | 651 | class SrsCloseStreamPacket : public SrsPacket |
| 685 | { | 652 | { |
| 686 | -protected: | ||
| 687 | - virtual const char* get_class_name() | ||
| 688 | - { | ||
| 689 | - return CLASS_NAME_STRING(SrsCloseStreamPacket); | ||
| 690 | - } | ||
| 691 | public: | 653 | public: |
| 692 | std::string command_name; | 654 | std::string command_name; |
| 693 | double transaction_id; | 655 | double transaction_id; |
| @@ -695,6 +657,7 @@ public: | @@ -695,6 +657,7 @@ public: | ||
| 695 | public: | 657 | public: |
| 696 | SrsCloseStreamPacket(); | 658 | SrsCloseStreamPacket(); |
| 697 | virtual ~SrsCloseStreamPacket(); | 659 | virtual ~SrsCloseStreamPacket(); |
| 660 | +// decode functions for concrete packet to override. | ||
| 698 | public: | 661 | public: |
| 699 | virtual int decode(SrsStream* stream); | 662 | virtual int decode(SrsStream* stream); |
| 700 | }; | 663 | }; |
| @@ -704,11 +667,6 @@ public: | @@ -704,11 +667,6 @@ public: | ||
| 704 | */ | 667 | */ |
| 705 | class SrsFMLEStartPacket : public SrsPacket | 668 | class SrsFMLEStartPacket : public SrsPacket |
| 706 | { | 669 | { |
| 707 | -protected: | ||
| 708 | - virtual const char* get_class_name() | ||
| 709 | - { | ||
| 710 | - return CLASS_NAME_STRING(SrsFMLEStartPacket); | ||
| 711 | - } | ||
| 712 | public: | 670 | public: |
| 713 | std::string command_name; | 671 | std::string command_name; |
| 714 | double transaction_id; | 672 | double transaction_id; |
| @@ -717,15 +675,17 @@ public: | @@ -717,15 +675,17 @@ public: | ||
| 717 | public: | 675 | public: |
| 718 | SrsFMLEStartPacket(); | 676 | SrsFMLEStartPacket(); |
| 719 | virtual ~SrsFMLEStartPacket(); | 677 | virtual ~SrsFMLEStartPacket(); |
| 678 | +// decode functions for concrete packet to override. | ||
| 720 | public: | 679 | public: |
| 721 | virtual int decode(SrsStream* stream); | 680 | virtual int decode(SrsStream* stream); |
| 681 | +// encode functions for concrete packet to override. | ||
| 722 | public: | 682 | public: |
| 723 | virtual int get_perfer_cid(); | 683 | virtual int get_perfer_cid(); |
| 724 | -public: | ||
| 725 | virtual int get_message_type(); | 684 | virtual int get_message_type(); |
| 726 | protected: | 685 | protected: |
| 727 | virtual int get_size(); | 686 | virtual int get_size(); |
| 728 | virtual int encode_packet(SrsStream* stream); | 687 | virtual int encode_packet(SrsStream* stream); |
| 688 | +// factory method to create specified FMLE packet. | ||
| 729 | public: | 689 | public: |
| 730 | static SrsFMLEStartPacket* create_release_stream(std::string stream); | 690 | static SrsFMLEStartPacket* create_release_stream(std::string stream); |
| 731 | static SrsFMLEStartPacket* create_FC_publish(std::string stream); | 691 | static SrsFMLEStartPacket* create_FC_publish(std::string stream); |
| @@ -735,11 +695,6 @@ public: | @@ -735,11 +695,6 @@ public: | ||
| 735 | */ | 695 | */ |
| 736 | class SrsFMLEStartResPacket : public SrsPacket | 696 | class SrsFMLEStartResPacket : public SrsPacket |
| 737 | { | 697 | { |
| 738 | -protected: | ||
| 739 | - virtual const char* get_class_name() | ||
| 740 | - { | ||
| 741 | - return CLASS_NAME_STRING(SrsFMLEStartResPacket); | ||
| 742 | - } | ||
| 743 | public: | 698 | public: |
| 744 | std::string command_name; | 699 | std::string command_name; |
| 745 | double transaction_id; | 700 | double transaction_id; |
| @@ -748,11 +703,12 @@ public: | @@ -748,11 +703,12 @@ public: | ||
| 748 | public: | 703 | public: |
| 749 | SrsFMLEStartResPacket(double _transaction_id); | 704 | SrsFMLEStartResPacket(double _transaction_id); |
| 750 | virtual ~SrsFMLEStartResPacket(); | 705 | virtual ~SrsFMLEStartResPacket(); |
| 706 | +// decode functions for concrete packet to override. | ||
| 751 | public: | 707 | public: |
| 752 | virtual int decode(SrsStream* stream); | 708 | virtual int decode(SrsStream* stream); |
| 709 | +// encode functions for concrete packet to override. | ||
| 753 | public: | 710 | public: |
| 754 | virtual int get_perfer_cid(); | 711 | virtual int get_perfer_cid(); |
| 755 | -public: | ||
| 756 | virtual int get_message_type(); | 712 | virtual int get_message_type(); |
| 757 | protected: | 713 | protected: |
| 758 | virtual int get_size(); | 714 | virtual int get_size(); |
| @@ -768,11 +724,6 @@ protected: | @@ -768,11 +724,6 @@ protected: | ||
| 768 | */ | 724 | */ |
| 769 | class SrsPublishPacket : public SrsPacket | 725 | class SrsPublishPacket : public SrsPacket |
| 770 | { | 726 | { |
| 771 | -protected: | ||
| 772 | - virtual const char* get_class_name() | ||
| 773 | - { | ||
| 774 | - return CLASS_NAME_STRING(SrsPublishPacket); | ||
| 775 | - } | ||
| 776 | public: | 727 | public: |
| 777 | std::string command_name; | 728 | std::string command_name; |
| 778 | double transaction_id; | 729 | double transaction_id; |
| @@ -783,11 +734,12 @@ public: | @@ -783,11 +734,12 @@ public: | ||
| 783 | public: | 734 | public: |
| 784 | SrsPublishPacket(); | 735 | SrsPublishPacket(); |
| 785 | virtual ~SrsPublishPacket(); | 736 | virtual ~SrsPublishPacket(); |
| 737 | +// decode functions for concrete packet to override. | ||
| 786 | public: | 738 | public: |
| 787 | virtual int decode(SrsStream* stream); | 739 | virtual int decode(SrsStream* stream); |
| 740 | +// encode functions for concrete packet to override. | ||
| 788 | public: | 741 | public: |
| 789 | virtual int get_perfer_cid(); | 742 | virtual int get_perfer_cid(); |
| 790 | -public: | ||
| 791 | virtual int get_message_type(); | 743 | virtual int get_message_type(); |
| 792 | protected: | 744 | protected: |
| 793 | virtual int get_size(); | 745 | virtual int get_size(); |
| @@ -801,11 +753,6 @@ protected: | @@ -801,11 +753,6 @@ protected: | ||
| 801 | */ | 753 | */ |
| 802 | class SrsPausePacket : public SrsPacket | 754 | class SrsPausePacket : public SrsPacket |
| 803 | { | 755 | { |
| 804 | -protected: | ||
| 805 | - virtual const char* get_class_name() | ||
| 806 | - { | ||
| 807 | - return CLASS_NAME_STRING(SrsPausePacket); | ||
| 808 | - } | ||
| 809 | public: | 756 | public: |
| 810 | std::string command_name; | 757 | std::string command_name; |
| 811 | double transaction_id; | 758 | double transaction_id; |
| @@ -815,6 +762,7 @@ public: | @@ -815,6 +762,7 @@ public: | ||
| 815 | public: | 762 | public: |
| 816 | SrsPausePacket(); | 763 | SrsPausePacket(); |
| 817 | virtual ~SrsPausePacket(); | 764 | virtual ~SrsPausePacket(); |
| 765 | +// decode functions for concrete packet to override. | ||
| 818 | public: | 766 | public: |
| 819 | virtual int decode(SrsStream* stream); | 767 | virtual int decode(SrsStream* stream); |
| 820 | }; | 768 | }; |
| @@ -825,11 +773,6 @@ public: | @@ -825,11 +773,6 @@ public: | ||
| 825 | */ | 773 | */ |
| 826 | class SrsPlayPacket : public SrsPacket | 774 | class SrsPlayPacket : public SrsPacket |
| 827 | { | 775 | { |
| 828 | -protected: | ||
| 829 | - virtual const char* get_class_name() | ||
| 830 | - { | ||
| 831 | - return CLASS_NAME_STRING(SrsPlayPacket); | ||
| 832 | - } | ||
| 833 | public: | 776 | public: |
| 834 | std::string command_name; | 777 | std::string command_name; |
| 835 | double transaction_id; | 778 | double transaction_id; |
| @@ -841,11 +784,12 @@ public: | @@ -841,11 +784,12 @@ public: | ||
| 841 | public: | 784 | public: |
| 842 | SrsPlayPacket(); | 785 | SrsPlayPacket(); |
| 843 | virtual ~SrsPlayPacket(); | 786 | virtual ~SrsPlayPacket(); |
| 787 | +// decode functions for concrete packet to override. | ||
| 844 | public: | 788 | public: |
| 845 | virtual int decode(SrsStream* stream); | 789 | virtual int decode(SrsStream* stream); |
| 790 | +// encode functions for concrete packet to override. | ||
| 846 | public: | 791 | public: |
| 847 | virtual int get_perfer_cid(); | 792 | virtual int get_perfer_cid(); |
| 848 | -public: | ||
| 849 | virtual int get_message_type(); | 793 | virtual int get_message_type(); |
| 850 | protected: | 794 | protected: |
| 851 | virtual int get_size(); | 795 | virtual int get_size(); |
| @@ -857,11 +801,6 @@ protected: | @@ -857,11 +801,6 @@ protected: | ||
| 857 | */ | 801 | */ |
| 858 | class SrsPlayResPacket : public SrsPacket | 802 | class SrsPlayResPacket : public SrsPacket |
| 859 | { | 803 | { |
| 860 | -protected: | ||
| 861 | - virtual const char* get_class_name() | ||
| 862 | - { | ||
| 863 | - return CLASS_NAME_STRING(SrsPlayResPacket); | ||
| 864 | - } | ||
| 865 | public: | 804 | public: |
| 866 | std::string command_name; | 805 | std::string command_name; |
| 867 | double transaction_id; | 806 | double transaction_id; |
| @@ -870,9 +809,9 @@ public: | @@ -870,9 +809,9 @@ public: | ||
| 870 | public: | 809 | public: |
| 871 | SrsPlayResPacket(); | 810 | SrsPlayResPacket(); |
| 872 | virtual ~SrsPlayResPacket(); | 811 | virtual ~SrsPlayResPacket(); |
| 812 | +// encode functions for concrete packet to override. | ||
| 873 | public: | 813 | public: |
| 874 | virtual int get_perfer_cid(); | 814 | virtual int get_perfer_cid(); |
| 875 | -public: | ||
| 876 | virtual int get_message_type(); | 815 | virtual int get_message_type(); |
| 877 | protected: | 816 | protected: |
| 878 | virtual int get_size(); | 817 | virtual int get_size(); |
| @@ -884,11 +823,6 @@ protected: | @@ -884,11 +823,6 @@ protected: | ||
| 884 | */ | 823 | */ |
| 885 | class SrsOnBWDonePacket : public SrsPacket | 824 | class SrsOnBWDonePacket : public SrsPacket |
| 886 | { | 825 | { |
| 887 | -protected: | ||
| 888 | - virtual const char* get_class_name() | ||
| 889 | - { | ||
| 890 | - return CLASS_NAME_STRING(SrsOnBWDonePacket); | ||
| 891 | - } | ||
| 892 | public: | 826 | public: |
| 893 | std::string command_name; | 827 | std::string command_name; |
| 894 | double transaction_id; | 828 | double transaction_id; |
| @@ -896,9 +830,9 @@ public: | @@ -896,9 +830,9 @@ public: | ||
| 896 | public: | 830 | public: |
| 897 | SrsOnBWDonePacket(); | 831 | SrsOnBWDonePacket(); |
| 898 | virtual ~SrsOnBWDonePacket(); | 832 | virtual ~SrsOnBWDonePacket(); |
| 833 | +// encode functions for concrete packet to override. | ||
| 899 | public: | 834 | public: |
| 900 | virtual int get_perfer_cid(); | 835 | virtual int get_perfer_cid(); |
| 901 | -public: | ||
| 902 | virtual int get_message_type(); | 836 | virtual int get_message_type(); |
| 903 | protected: | 837 | protected: |
| 904 | virtual int get_size(); | 838 | virtual int get_size(); |
| @@ -911,11 +845,6 @@ protected: | @@ -911,11 +845,6 @@ protected: | ||
| 911 | */ | 845 | */ |
| 912 | class SrsOnStatusCallPacket : public SrsPacket | 846 | class SrsOnStatusCallPacket : public SrsPacket |
| 913 | { | 847 | { |
| 914 | -protected: | ||
| 915 | - virtual const char* get_class_name() | ||
| 916 | - { | ||
| 917 | - return CLASS_NAME_STRING(SrsOnStatusCallPacket); | ||
| 918 | - } | ||
| 919 | public: | 848 | public: |
| 920 | std::string command_name; | 849 | std::string command_name; |
| 921 | double transaction_id; | 850 | double transaction_id; |
| @@ -924,9 +853,9 @@ public: | @@ -924,9 +853,9 @@ public: | ||
| 924 | public: | 853 | public: |
| 925 | SrsOnStatusCallPacket(); | 854 | SrsOnStatusCallPacket(); |
| 926 | virtual ~SrsOnStatusCallPacket(); | 855 | virtual ~SrsOnStatusCallPacket(); |
| 856 | +// encode functions for concrete packet to override. | ||
| 927 | public: | 857 | public: |
| 928 | virtual int get_perfer_cid(); | 858 | virtual int get_perfer_cid(); |
| 929 | -public: | ||
| 930 | virtual int get_message_type(); | 859 | virtual int get_message_type(); |
| 931 | protected: | 860 | protected: |
| 932 | virtual int get_size(); | 861 | virtual int get_size(); |
| @@ -943,11 +872,6 @@ class SrsBandwidthPacket : public SrsPacket | @@ -943,11 +872,6 @@ class SrsBandwidthPacket : public SrsPacket | ||
| 943 | { | 872 | { |
| 944 | private: | 873 | private: |
| 945 | disable_default_copy(SrsBandwidthPacket); | 874 | disable_default_copy(SrsBandwidthPacket); |
| 946 | -protected: | ||
| 947 | - virtual const char* get_class_name() | ||
| 948 | - { | ||
| 949 | - return CLASS_NAME_STRING(SrsBandwidthPacket); | ||
| 950 | - } | ||
| 951 | public: | 875 | public: |
| 952 | std::string command_name; | 876 | std::string command_name; |
| 953 | double transaction_id; | 877 | double transaction_id; |
| @@ -956,15 +880,17 @@ public: | @@ -956,15 +880,17 @@ public: | ||
| 956 | public: | 880 | public: |
| 957 | SrsBandwidthPacket(); | 881 | SrsBandwidthPacket(); |
| 958 | virtual ~SrsBandwidthPacket(); | 882 | virtual ~SrsBandwidthPacket(); |
| 883 | +// decode functions for concrete packet to override. | ||
| 959 | public: | 884 | public: |
| 960 | - virtual int get_perfer_cid(); | 885 | + virtual int decode(SrsStream* stream); |
| 886 | +// encode functions for concrete packet to override. | ||
| 961 | public: | 887 | public: |
| 888 | + virtual int get_perfer_cid(); | ||
| 962 | virtual int get_message_type(); | 889 | virtual int get_message_type(); |
| 963 | protected: | 890 | protected: |
| 964 | virtual int get_size(); | 891 | virtual int get_size(); |
| 965 | virtual int encode_packet(SrsStream* stream); | 892 | virtual int encode_packet(SrsStream* stream); |
| 966 | -public: | ||
| 967 | - virtual int decode(SrsStream* stream); | 893 | +// help function for bandwidth packet. |
| 968 | public: | 894 | public: |
| 969 | virtual bool is_starting_play(); | 895 | virtual bool is_starting_play(); |
| 970 | virtual bool is_stopped_play(); | 896 | virtual bool is_stopped_play(); |
| @@ -987,20 +913,15 @@ private: | @@ -987,20 +913,15 @@ private: | ||
| 987 | */ | 913 | */ |
| 988 | class SrsOnStatusDataPacket : public SrsPacket | 914 | class SrsOnStatusDataPacket : public SrsPacket |
| 989 | { | 915 | { |
| 990 | -protected: | ||
| 991 | - virtual const char* get_class_name() | ||
| 992 | - { | ||
| 993 | - return CLASS_NAME_STRING(SrsOnStatusDataPacket); | ||
| 994 | - } | ||
| 995 | public: | 916 | public: |
| 996 | std::string command_name; | 917 | std::string command_name; |
| 997 | SrsAmf0Object* data; | 918 | SrsAmf0Object* data; |
| 998 | public: | 919 | public: |
| 999 | SrsOnStatusDataPacket(); | 920 | SrsOnStatusDataPacket(); |
| 1000 | virtual ~SrsOnStatusDataPacket(); | 921 | virtual ~SrsOnStatusDataPacket(); |
| 922 | +// encode functions for concrete packet to override. | ||
| 1001 | public: | 923 | public: |
| 1002 | virtual int get_perfer_cid(); | 924 | virtual int get_perfer_cid(); |
| 1003 | -public: | ||
| 1004 | virtual int get_message_type(); | 925 | virtual int get_message_type(); |
| 1005 | protected: | 926 | protected: |
| 1006 | virtual int get_size(); | 927 | virtual int get_size(); |
| @@ -1013,11 +934,6 @@ protected: | @@ -1013,11 +934,6 @@ protected: | ||
| 1013 | */ | 934 | */ |
| 1014 | class SrsSampleAccessPacket : public SrsPacket | 935 | class SrsSampleAccessPacket : public SrsPacket |
| 1015 | { | 936 | { |
| 1016 | -protected: | ||
| 1017 | - virtual const char* get_class_name() | ||
| 1018 | - { | ||
| 1019 | - return CLASS_NAME_STRING(SrsSampleAccessPacket); | ||
| 1020 | - } | ||
| 1021 | public: | 937 | public: |
| 1022 | std::string command_name; | 938 | std::string command_name; |
| 1023 | bool video_sample_access; | 939 | bool video_sample_access; |
| @@ -1025,9 +941,9 @@ public: | @@ -1025,9 +941,9 @@ public: | ||
| 1025 | public: | 941 | public: |
| 1026 | SrsSampleAccessPacket(); | 942 | SrsSampleAccessPacket(); |
| 1027 | virtual ~SrsSampleAccessPacket(); | 943 | virtual ~SrsSampleAccessPacket(); |
| 944 | +// encode functions for concrete packet to override. | ||
| 1028 | public: | 945 | public: |
| 1029 | virtual int get_perfer_cid(); | 946 | virtual int get_perfer_cid(); |
| 1030 | -public: | ||
| 1031 | virtual int get_message_type(); | 947 | virtual int get_message_type(); |
| 1032 | protected: | 948 | protected: |
| 1033 | virtual int get_size(); | 949 | virtual int get_size(); |
| @@ -1041,22 +957,18 @@ protected: | @@ -1041,22 +957,18 @@ protected: | ||
| 1041 | */ | 957 | */ |
| 1042 | class SrsOnMetaDataPacket : public SrsPacket | 958 | class SrsOnMetaDataPacket : public SrsPacket |
| 1043 | { | 959 | { |
| 1044 | -protected: | ||
| 1045 | - virtual const char* get_class_name() | ||
| 1046 | - { | ||
| 1047 | - return CLASS_NAME_STRING(SrsOnMetaDataPacket); | ||
| 1048 | - } | ||
| 1049 | public: | 960 | public: |
| 1050 | std::string name; | 961 | std::string name; |
| 1051 | SrsAmf0Object* metadata; | 962 | SrsAmf0Object* metadata; |
| 1052 | public: | 963 | public: |
| 1053 | SrsOnMetaDataPacket(); | 964 | SrsOnMetaDataPacket(); |
| 1054 | virtual ~SrsOnMetaDataPacket(); | 965 | virtual ~SrsOnMetaDataPacket(); |
| 966 | +// decode functions for concrete packet to override. | ||
| 1055 | public: | 967 | public: |
| 1056 | virtual int decode(SrsStream* stream); | 968 | virtual int decode(SrsStream* stream); |
| 969 | +// encode functions for concrete packet to override. | ||
| 1057 | public: | 970 | public: |
| 1058 | virtual int get_perfer_cid(); | 971 | virtual int get_perfer_cid(); |
| 1059 | -public: | ||
| 1060 | virtual int get_message_type(); | 972 | virtual int get_message_type(); |
| 1061 | protected: | 973 | protected: |
| 1062 | virtual int get_size(); | 974 | virtual int get_size(); |
| @@ -1070,21 +982,17 @@ protected: | @@ -1070,21 +982,17 @@ protected: | ||
| 1070 | */ | 982 | */ |
| 1071 | class SrsSetWindowAckSizePacket : public SrsPacket | 983 | class SrsSetWindowAckSizePacket : public SrsPacket |
| 1072 | { | 984 | { |
| 1073 | -protected: | ||
| 1074 | - virtual const char* get_class_name() | ||
| 1075 | - { | ||
| 1076 | - return CLASS_NAME_STRING(SrsSetWindowAckSizePacket); | ||
| 1077 | - } | ||
| 1078 | public: | 985 | public: |
| 1079 | int32_t ackowledgement_window_size; | 986 | int32_t ackowledgement_window_size; |
| 1080 | public: | 987 | public: |
| 1081 | SrsSetWindowAckSizePacket(); | 988 | SrsSetWindowAckSizePacket(); |
| 1082 | virtual ~SrsSetWindowAckSizePacket(); | 989 | virtual ~SrsSetWindowAckSizePacket(); |
| 990 | +// decode functions for concrete packet to override. | ||
| 1083 | public: | 991 | public: |
| 1084 | virtual int decode(SrsStream* stream); | 992 | virtual int decode(SrsStream* stream); |
| 993 | +// encode functions for concrete packet to override. | ||
| 1085 | public: | 994 | public: |
| 1086 | virtual int get_perfer_cid(); | 995 | virtual int get_perfer_cid(); |
| 1087 | -public: | ||
| 1088 | virtual int get_message_type(); | 996 | virtual int get_message_type(); |
| 1089 | protected: | 997 | protected: |
| 1090 | virtual int get_size(); | 998 | virtual int get_size(); |
| @@ -1098,19 +1006,14 @@ protected: | @@ -1098,19 +1006,14 @@ protected: | ||
| 1098 | */ | 1006 | */ |
| 1099 | class SrsAcknowledgementPacket : public SrsPacket | 1007 | class SrsAcknowledgementPacket : public SrsPacket |
| 1100 | { | 1008 | { |
| 1101 | -protected: | ||
| 1102 | - virtual const char* get_class_name() | ||
| 1103 | - { | ||
| 1104 | - return CLASS_NAME_STRING(SrsAcknowledgementPacket); | ||
| 1105 | - } | ||
| 1106 | public: | 1009 | public: |
| 1107 | int32_t sequence_number; | 1010 | int32_t sequence_number; |
| 1108 | public: | 1011 | public: |
| 1109 | SrsAcknowledgementPacket(); | 1012 | SrsAcknowledgementPacket(); |
| 1110 | virtual ~SrsAcknowledgementPacket(); | 1013 | virtual ~SrsAcknowledgementPacket(); |
| 1014 | +// encode functions for concrete packet to override. | ||
| 1111 | public: | 1015 | public: |
| 1112 | virtual int get_perfer_cid(); | 1016 | virtual int get_perfer_cid(); |
| 1113 | -public: | ||
| 1114 | virtual int get_message_type(); | 1017 | virtual int get_message_type(); |
| 1115 | protected: | 1018 | protected: |
| 1116 | virtual int get_size(); | 1019 | virtual int get_size(); |
| @@ -1124,21 +1027,17 @@ protected: | @@ -1124,21 +1027,17 @@ protected: | ||
| 1124 | */ | 1027 | */ |
| 1125 | class SrsSetChunkSizePacket : public SrsPacket | 1028 | class SrsSetChunkSizePacket : public SrsPacket |
| 1126 | { | 1029 | { |
| 1127 | -protected: | ||
| 1128 | - virtual const char* get_class_name() | ||
| 1129 | - { | ||
| 1130 | - return CLASS_NAME_STRING(SrsSetChunkSizePacket); | ||
| 1131 | - } | ||
| 1132 | public: | 1030 | public: |
| 1133 | int32_t chunk_size; | 1031 | int32_t chunk_size; |
| 1134 | public: | 1032 | public: |
| 1135 | SrsSetChunkSizePacket(); | 1033 | SrsSetChunkSizePacket(); |
| 1136 | virtual ~SrsSetChunkSizePacket(); | 1034 | virtual ~SrsSetChunkSizePacket(); |
| 1035 | +// decode functions for concrete packet to override. | ||
| 1137 | public: | 1036 | public: |
| 1138 | virtual int decode(SrsStream* stream); | 1037 | virtual int decode(SrsStream* stream); |
| 1038 | +// encode functions for concrete packet to override. | ||
| 1139 | public: | 1039 | public: |
| 1140 | virtual int get_perfer_cid(); | 1040 | virtual int get_perfer_cid(); |
| 1141 | -public: | ||
| 1142 | virtual int get_message_type(); | 1041 | virtual int get_message_type(); |
| 1143 | protected: | 1042 | protected: |
| 1144 | virtual int get_size(); | 1043 | virtual int get_size(); |
| @@ -1152,20 +1051,15 @@ protected: | @@ -1152,20 +1051,15 @@ protected: | ||
| 1152 | */ | 1051 | */ |
| 1153 | class SrsSetPeerBandwidthPacket : public SrsPacket | 1052 | class SrsSetPeerBandwidthPacket : public SrsPacket |
| 1154 | { | 1053 | { |
| 1155 | -protected: | ||
| 1156 | - virtual const char* get_class_name() | ||
| 1157 | - { | ||
| 1158 | - return CLASS_NAME_STRING(SrsSetPeerBandwidthPacket); | ||
| 1159 | - } | ||
| 1160 | public: | 1054 | public: |
| 1161 | int32_t bandwidth; | 1055 | int32_t bandwidth; |
| 1162 | int8_t type; | 1056 | int8_t type; |
| 1163 | public: | 1057 | public: |
| 1164 | SrsSetPeerBandwidthPacket(); | 1058 | SrsSetPeerBandwidthPacket(); |
| 1165 | virtual ~SrsSetPeerBandwidthPacket(); | 1059 | virtual ~SrsSetPeerBandwidthPacket(); |
| 1060 | +// encode functions for concrete packet to override. | ||
| 1166 | public: | 1061 | public: |
| 1167 | virtual int get_perfer_cid(); | 1062 | virtual int get_perfer_cid(); |
| 1168 | -public: | ||
| 1169 | virtual int get_message_type(); | 1063 | virtual int get_message_type(); |
| 1170 | protected: | 1064 | protected: |
| 1171 | virtual int get_size(); | 1065 | virtual int get_size(); |
| @@ -1203,11 +1097,6 @@ enum SrcPCUCEventType | @@ -1203,11 +1097,6 @@ enum SrcPCUCEventType | ||
| 1203 | */ | 1097 | */ |
| 1204 | class SrsUserControlPacket : public SrsPacket | 1098 | class SrsUserControlPacket : public SrsPacket |
| 1205 | { | 1099 | { |
| 1206 | -protected: | ||
| 1207 | - virtual const char* get_class_name() | ||
| 1208 | - { | ||
| 1209 | - return CLASS_NAME_STRING(SrsUserControlPacket); | ||
| 1210 | - } | ||
| 1211 | public: | 1100 | public: |
| 1212 | // @see: SrcPCUCEventType | 1101 | // @see: SrcPCUCEventType |
| 1213 | int16_t event_type; | 1102 | int16_t event_type; |
| @@ -1219,11 +1108,12 @@ public: | @@ -1219,11 +1108,12 @@ public: | ||
| 1219 | public: | 1108 | public: |
| 1220 | SrsUserControlPacket(); | 1109 | SrsUserControlPacket(); |
| 1221 | virtual ~SrsUserControlPacket(); | 1110 | virtual ~SrsUserControlPacket(); |
| 1111 | +// decode functions for concrete packet to override. | ||
| 1222 | public: | 1112 | public: |
| 1223 | virtual int decode(SrsStream* stream); | 1113 | virtual int decode(SrsStream* stream); |
| 1114 | +// encode functions for concrete packet to override. | ||
| 1224 | public: | 1115 | public: |
| 1225 | virtual int get_perfer_cid(); | 1116 | virtual int get_perfer_cid(); |
| 1226 | -public: | ||
| 1227 | virtual int get_message_type(); | 1117 | virtual int get_message_type(); |
| 1228 | protected: | 1118 | protected: |
| 1229 | virtual int get_size(); | 1119 | virtual int get_size(); |
-
请 注册 或 登录 后发表评论