| 709 | } |
| 710 | |
| 711 | RtmpContext::RtmpContext(const RtmpClientOptions* copt, const Server* server) |
| 712 | : _state(RtmpContext::STATE_UNINITIALIZED) |
| 713 | , _s1_digest(NULL) |
| 714 | , _chunk_size_out(RTMP_INITIAL_CHUNK_SIZE) |
| 715 | , _chunk_size_in(RTMP_INITIAL_CHUNK_SIZE) |
| 716 | , _window_ack_size(RTMP_DEFAULT_WINDOW_ACK_SIZE) |
| 717 | , _nonack_bytes(0) |
| 718 | , _received_bytes(0) |
| 719 | , _cs_id_allocator(RTMP_CONTROL_CHUNK_STREAM_ID + 1) |
| 720 | , _ms_id_allocator(RTMP_CONTROL_MESSAGE_STREAM_ID + 1) |
| 721 | , _client_options(copt) |
| 722 | , _on_connect(NULL) |
| 723 | , _on_connect_arg(NULL) |
| 724 | , _only_check_simple_s0s1(false) |
| 725 | , _create_stream_with_play_or_publish(false) |
| 726 | , _server(server) |
| 727 | , _service(NULL) |
| 728 | , _trans_id_allocator(2) |
| 729 | , _simplified_rtmp(false) { |
| 730 | if (server) { |
| 731 | _service = server->options().rtmp_service; |
| 732 | } |
| 733 | _free_ms_ids.reserve(32); |
| 734 | if (_mstream_map.init(1024, 70) != 0) { |
| 735 | LOG(FATAL) << "Fail to initialize _mstream_map"; |
| 736 | } |
| 737 | if (_trans_map.init(1024, 70) != 0) { |
| 738 | LOG(FATAL) << "Fail to initialize _trans_map"; |
| 739 | } |
| 740 | memset(static_cast<void*>(_cstream_ctx), 0, sizeof(_cstream_ctx)); |
| 741 | } |
| 742 | |
| 743 | RtmpContext::~RtmpContext() { |
| 744 | if (!_mstream_map.empty()) { |