Skip to content

Commit

Permalink
Fix #1304, Fix ST coroutine pull error. 3.0.47
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Apr 6, 2019
1 parent 23a2d8e commit f2b4bc7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Please select according to languages:

### V3 changes

* v3.0, 2019-04-06, Merge [#1304][bug #1304], Fix ST coroutine pull error. 3.0.47
* v3.0, 2019-04-05, Merge [#1339][bug #1339], Support HTTP-FLV params. 3.0.46
* v3.0, 2018-11-11, Merge [#1261][bug #1261], Support `_definst_` for Wowza. 3.0.44
* v3.0, 2018-08-26, SRS [console](https://github.com/ossrs/srs-ngb) support both [Chinese](http://ossrs.net:1985/console/ng_index.html) and [English](http://ossrs.net:1985/console/en_index.html).
Expand Down
23 changes: 17 additions & 6 deletions trunk/src/app/srs_app_st.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ srs_error_t SrsSTCoroutine::start()
srs_error_t err = srs_success;

if (started || disposed) {
err = srs_error_new(ERROR_THREAD_DISPOSED,
"failed for disposed=%d, started=%d", disposed, started);
err = srs_error_new(ERROR_THREAD_DISPOSED, "failed for disposed=%d, started=%d", disposed, started);

if (trd_err == srs_success) {
trd_err = srs_error_copy(err);
Expand Down Expand Up @@ -139,9 +138,11 @@ void SrsSTCoroutine::stop()
srs_assert(!r0);

// Always override the error by the error from worker.
if ((srs_error_t)res != srs_success) {
srs_error_t err_res = (srs_error_t)res;
if (err_res != srs_success && trd_err != err_res) {
srs_freep(trd_err);
trd_err = (srs_error_t)res;
// It's ok to directly use it, because it's returned by st_thread_join.
trd_err = err_res;
return;
}

Expand Down Expand Up @@ -198,7 +199,17 @@ srs_error_t SrsSTCoroutine::cycle()
void* SrsSTCoroutine::pfn(void* arg)
{
SrsSTCoroutine* p = (SrsSTCoroutine*)arg;
void* res = (void*)p->cycle();
return res;

srs_error_t err = p->cycle();

// Set the err for function pull to fetch it.
// @see https://github.com/ossrs/srs/pull/1304#issuecomment-480484151
if (err != srs_success) {
srs_freep(p->trd_err);
// It's ok to directly use it, because it's returned by st_thread_join.
p->trd_err = err;
}

return (void*)err;
}

2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// current release version
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 46
#define VERSION_REVISION 47

// generated by configure, only macros.
#include <srs_auto_headers.hpp>
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/utest/srs_utest_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2095,13 +2095,13 @@ VOID TEST(KernelUtility, AdtsUtils)
}

if (true) {
char data[] = {0xFF, 0x00};
uint8_t data[] = {0xFF, 0x00};
SrsBuffer buf((char*)data, sizeof(data));
EXPECT_TRUE(!srs_aac_startswith_adts(&buf));
}

if (true) {
char data[] = {0xFF, 0xF0};
uint8_t data[] = {0xFF, 0xF0};
SrsBuffer buf((char*)data, sizeof(data));
EXPECT_TRUE(srs_aac_startswith_adts(&buf));
}
Expand Down

0 comments on commit f2b4bc7

Please sign in to comment.