summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-02 18:54:19 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-02 18:54:19 +0000
commitfaede3bfd55af757bd3b76b075d435d6b31b2c0f (patch)
treebadc8973453990054ecbc923e5c80cc23f628d6b /pjlib
parent4b5a9b5ec7f7dd042d7fb40bccdf4ee44d28122b (diff)
Errno and memory size tweaking for Symbian
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1244 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/include/pj/compat/os_symbian.h1
-rw-r--r--pjlib/include/pj/config.h8
-rw-r--r--pjlib/include/pj/config_site_sample.h23
-rw-r--r--pjlib/include/pj/errno.h12
-rw-r--r--pjlib/src/pj/ioqueue_symbian.cpp59
-rw-r--r--pjlib/src/pj/sock_symbian.cpp3
6 files changed, 57 insertions, 49 deletions
diff --git a/pjlib/include/pj/compat/os_symbian.h b/pjlib/include/pj/compat/os_symbian.h
index 2871fe0a..b1b1cd1a 100644
--- a/pjlib/include/pj/compat/os_symbian.h
+++ b/pjlib/include/pj/compat/os_symbian.h
@@ -121,6 +121,7 @@
#define PJ_OS_HAS_CHECK_STACK 0
#define PJ_TERM_HAS_COLOR 0
#define PJ_NATIVE_STRING_IS_UNICODE 0
+#define PJ_NATIVE_ERR_POSITIVE 0
#define PJ_ATOMIC_VALUE_TYPE int
#define PJ_THREAD_DESC_SIZE 128
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index e6d4fd4c..197e525c 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -599,6 +599,14 @@
#endif
/**
+ * Is native platform error positive number?
+ * Default: 1 (yes)
+ */
+#ifndef PJ_NATIVE_ERR_POSITIVE
+# define PJ_NATIVE_ERR_POSITIVE 1
+#endif
+
+/**
* Include error message string in the library (pj_strerror()).
* This is very much desirable!
*
diff --git a/pjlib/include/pj/config_site_sample.h b/pjlib/include/pj/config_site_sample.h
index c4821de4..439d3512 100644
--- a/pjlib/include/pj/config_site_sample.h
+++ b/pjlib/include/pj/config_site_sample.h
@@ -26,23 +26,46 @@
# define PJMEDIA_HAS_SPEEX_AEC 0
#endif
+
/*
* Typical configuration for Symbian OS target
*/
#if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
+ /* We don't want to use float, for now */
# undef PJ_HAS_FLOATING_POINT
# define PJ_HAS_FLOATING_POINT 0
# define PJMEDIA_SOUND_IMPLEMENTATION PJMEDIA_SOUND_NULL_SOUND
+
+ /* Disable these */
# define PJMEDIA_HAS_LIBRESAMPLE 0
# define PJMEDIA_HAS_SPEEX_AEC 0
+ /* Disable all codecs but G.711, for now */
# define PJMEDIA_HAS_L16_CODEC 0
# define PJMEDIA_HAS_GSM_CODEC 0
# define PJMEDIA_HAS_ILBC_CODEC 0
# define PJMEDIA_HAS_SPEEX_CODEC 0
+# define PJSIP_MAX_PKT_LEN 8000
+
+ /* Since we don't have threads, log buffer can use static buffer */
+# define PJ_LOG_USE_STACK_BUFFER 0
+
+ /* Symbian has problem with too many large blocks */
+# define PJSIP_POOL_LEN_ENDPT 1000
+# define PJSIP_POOL_INC_ENDPT 1000
+# define PJSIP_POOL_RDATA_LEN 2000
+# define PJSIP_POOL_RDATA_INC 2000
+# define PJSIP_POOL_LEN_TDATA 2000
+# define PJSIP_POOL_INC_TDATA 512
+# define PJSIP_POOL_LEN_UA 2000
+# define PJSIP_POOL_INC_UA 1000
+# define PJSIP_POOL_TSX_LAYER_LEN 256
+# define PJSIP_POOL_TSX_LAYER_INC 256
+# define PJSIP_POOL_TSX_LEN 512
+# define PJSIP_POOL_TSX_INC 128
#endif
diff --git a/pjlib/include/pj/errno.h b/pjlib/include/pj/errno.h
index 71ba69fd..cd5d9164 100644
--- a/pjlib/include/pj/errno.h
+++ b/pjlib/include/pj/errno.h
@@ -167,7 +167,11 @@ PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code,
* @warning Macro implementation; the syserr argument may be evaluated
* multiple times.
*/
-#define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
+#if PJ_NATIVE_ERR_POSITIVE
+# define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
+#else
+# define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : PJ_ERRNO_START_SYS - e)
+#endif
/**
* @hideinitializer
@@ -179,7 +183,11 @@ PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code,
* multiple times. If the statcode was not created by
* pj_get_os_error or PJ_STATUS_FROM_OS, the results are undefined.
*/
-#define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS)
+#if PJ_NATIVE_ERR_POSITIVE
+# define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS)
+#else
+# define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : PJ_ERRNO_START_SYS - e)
+#endif
/**
diff --git a/pjlib/src/pj/ioqueue_symbian.cpp b/pjlib/src/pj/ioqueue_symbian.cpp
index 50f33503..df1fa46c 100644
--- a/pjlib/src/pj/ioqueue_symbian.cpp
+++ b/pjlib/src/pj/ioqueue_symbian.cpp
@@ -216,23 +216,8 @@ pj_status_t CIoqueueCallback::StartRead(pj_ioqueue_op_key_t *op_key,
sock_->Socket().Recv(aBufferPtr_, flags, iStatus);
}
- if (iStatus==KRequestPending) {
- SetActive();
- return PJ_EPENDING;
- } else {
- // Complete immediately (with success or error)
- if (iStatus == KErrNone) {
- *size = aBufferPtr_.Length();
- HandleReadCompletion();
- return PJ_SUCCESS;
- }
- else {
- pending_data_.read_.op_key_ = NULL;
- pending_data_.read_.addr_ = NULL;
- pending_data_.read_.addrlen_ = NULL;
- return PJ_RETURN_OS_ERROR(iStatus.Int());
- }
- }
+ SetActive();
+ return PJ_EPENDING;
}
@@ -260,24 +245,8 @@ pj_status_t CIoqueueCallback::StartAccept(pj_ioqueue_op_key_t *op_key,
type_ = TYPE_ACCEPT;
sock_->Socket().Accept(blank_sock_, iStatus);
- if (iStatus==KRequestPending) {
- SetActive();
- return PJ_EPENDING;
- } else {
- // Accept() completed immediately (with success or error).
- if (iStatus == KErrNone) {
- HandleAcceptCompletion();
- return PJ_SUCCESS;
- }
- else {
- pending_data_.accept_.op_key_ = NULL;
- pending_data_.accept_.new_sock_ = NULL;
- pending_data_.accept_.local_ = NULL;
- pending_data_.accept_.remote_ = NULL;
- pending_data_.accept_.addrlen_ = NULL;
- return PJ_RETURN_OS_ERROR(iStatus.Int());
- }
- }
+ SetActive();
+ return PJ_EPENDING;
}
@@ -286,17 +255,17 @@ pj_status_t CIoqueueCallback::StartAccept(pj_ioqueue_op_key_t *op_key,
//
void CIoqueueCallback::HandleReadCompletion()
{
- if (pending_data_.read_.addr_) {
- PjSymbianOS::Addr2pj(aAddress_,
- *(pj_sockaddr_in*)pending_data_.read_.addr_);
- pending_data_.read_.addr_ = NULL;
- }
- if (pending_data_.read_.addrlen_) {
- *pending_data_.read_.addrlen_ = sizeof(pj_sockaddr_in);
- pending_data_.read_.addrlen_ = NULL;
- }
+ if (pending_data_.read_.addr_) {
+ PjSymbianOS::Addr2pj(aAddress_,
+ *(pj_sockaddr_in*)pending_data_.read_.addr_);
+ pending_data_.read_.addr_ = NULL;
+ }
+ if (pending_data_.read_.addrlen_) {
+ *pending_data_.read_.addrlen_ = sizeof(pj_sockaddr_in);
+ pending_data_.read_.addrlen_ = NULL;
+ }
- pending_data_.read_.op_key_ = NULL;
+ pending_data_.read_.op_key_ = NULL;
}
diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp
index 1b79098a..5615dde7 100644
--- a/pjlib/src/pj/sock_symbian.cpp
+++ b/pjlib/src/pj/sock_symbian.cpp
@@ -151,8 +151,7 @@ void CPjSocketReader::StartRecvFrom(void (*cb)(void *key),
if (fromAddr == NULL) fromAddr = &recvAddr_;
sock_.Socket().RecvFrom(*aDesc, *fromAddr, flags, iStatus);
- if (iStatus == KRequestPending)
- SetActive();
+ SetActive();
}
void CPjSocketReader::DoCancel()