winlin

fix #304, fix hls bug, write pts/dts error. 2.0.124.

@@ -532,6 +532,7 @@ Supported operating systems and hardware: @@ -532,6 +532,7 @@ Supported operating systems and hardware:
532 532
533 ### SRS 2.0 history 533 ### SRS 2.0 history
534 534
  535 +* v2.0, 2015-02-24, for [#304](https://github.com/winlinvip/simple-rtmp-server/issues/304), fix hls bug, write pts/dts error. 2.0.124.
535 * v2.0, 2015-02-24, fix [#179](https://github.com/winlinvip/simple-rtmp-server/issues/179), support dvr http api. 2.0.123. 536 * v2.0, 2015-02-24, fix [#179](https://github.com/winlinvip/simple-rtmp-server/issues/179), support dvr http api. 2.0.123.
536 * v2.0, 2015-02-19, refine dvr, append file when dvr file exists. 2.0.122. 537 * v2.0, 2015-02-19, refine dvr, append file when dvr file exists. 2.0.122.
537 * v2.0, 2015-02-19, refine pithy print to more easyer to use. 2.0.121. 538 * v2.0, 2015-02-19, refine pithy print to more easyer to use. 2.0.121.
@@ -928,6 +928,8 @@ int SrsHls::on_audio(SrsSharedPtrMessage* __audio) @@ -928,6 +928,8 @@ int SrsHls::on_audio(SrsSharedPtrMessage* __audio)
928 return ret; 928 return ret;
929 } 929 }
930 } 930 }
  931 + srs_info("audio decoded, type=%d, codec=%d, cts=%d, size=%d, time=%"PRId64,
  932 + sample->frame_type, codec->audio_codec_id, sample->cts, audio->size, audio->timestamp);
931 SrsCodecAudio acodec = (SrsCodecAudio)codec->audio_codec_id; 933 SrsCodecAudio acodec = (SrsCodecAudio)codec->audio_codec_id;
932 934
933 // ts support audio codec: aac/mp3 935 // ts support audio codec: aac/mp3
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 123 34 +#define VERSION_REVISION 124
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -1960,16 +1960,16 @@ int SrsTsPayloadPES::encode_33bits_dts_pts(SrsStream* stream, u_int8_t fb, int64 @@ -1960,16 +1960,16 @@ int SrsTsPayloadPES::encode_33bits_dts_pts(SrsStream* stream, u_int8_t fb, int64
1960 char* p = stream->data() + stream->pos(); 1960 char* p = stream->data() + stream->pos();
1961 stream->skip(5); 1961 stream->skip(5);
1962 1962
1963 - int32_t val; 1963 + int32_t val = 0;
1964 1964
1965 - val = fb << 4 | (((pts >> 30) & 0x07) << 1) | 1; 1965 + val = fb << 4 | (((v >> 30) & 0x07) << 1) | 1;
1966 *p++ = val; 1966 *p++ = val;
1967 1967
1968 - val = (((pts >> 15) & 0x7fff) << 1) | 1; 1968 + val = (((v >> 15) & 0x7fff) << 1) | 1;
1969 *p++ = (val >> 8); 1969 *p++ = (val >> 8);
1970 *p++ = val; 1970 *p++ = val;
1971 1971
1972 - val = (((pts) & 0x7fff) << 1) | 1; 1972 + val = (((v) & 0x7fff) << 1) | 1;
1973 *p++ = (val >> 8); 1973 *p++ = (val >> 8);
1974 *p++ = val; 1974 *p++ = val;
1975 1975
@@ -2653,6 +2653,9 @@ int SrsTSMuxer::update_acodec(SrsCodecAudio ac) @@ -2653,6 +2653,9 @@ int SrsTSMuxer::update_acodec(SrsCodecAudio ac)
2653 int SrsTSMuxer::write_audio(SrsTsMessage* audio) 2653 int SrsTSMuxer::write_audio(SrsTsMessage* audio)
2654 { 2654 {
2655 int ret = ERROR_SUCCESS; 2655 int ret = ERROR_SUCCESS;
  2656 +
  2657 + srs_info("hls: write audio pts=%"PRId64", dts=%"PRId64", size=%d",
  2658 + audio->pts, audio->dts, audio->PES_packet_length);
2656 2659
2657 if ((ret = context->encode(writer, audio, vcodec, acodec)) != ERROR_SUCCESS) { 2660 if ((ret = context->encode(writer, audio, vcodec, acodec)) != ERROR_SUCCESS) {
2658 srs_error("hls encode audio failed. ret=%d", ret); 2661 srs_error("hls encode audio failed. ret=%d", ret);
@@ -2666,6 +2669,9 @@ int SrsTSMuxer::write_audio(SrsTsMessage* audio) @@ -2666,6 +2669,9 @@ int SrsTSMuxer::write_audio(SrsTsMessage* audio)
2666 int SrsTSMuxer::write_video(SrsTsMessage* video) 2669 int SrsTSMuxer::write_video(SrsTsMessage* video)
2667 { 2670 {
2668 int ret = ERROR_SUCCESS; 2671 int ret = ERROR_SUCCESS;
  2672 +
  2673 + srs_info("hls: write video pts=%"PRId64", dts=%"PRId64", size=%d",
  2674 + video->pts, video->dts, video->PES_packet_length);
2669 2675
2670 if ((ret = context->encode(writer, video, vcodec, acodec)) != ERROR_SUCCESS) { 2676 if ((ret = context->encode(writer, video, vcodec, acodec)) != ERROR_SUCCESS) {
2671 srs_error("hls encode video failed. ret=%d", ret); 2677 srs_error("hls encode video failed. ret=%d", ret);