Changeset 734
- Timestamp:
- 02/03/12 20:52:54 (4 months ago)
- Location:
- trunk/sources
- Files:
-
- 49 edited
-
crtmpserver/src/crtmpserver.cpp (modified) (2 diffs)
-
thelib/include/mediaformats/mp4/atomdata.h (modified) (1 diff)
-
thelib/include/mediaformats/mp4/generateatom.sh (modified) (1 diff)
-
thelib/include/netio/fdstats.h (modified) (2 diffs)
-
thelib/include/netio/netio.h (modified) (1 diff)
-
thelib/include/protocols/cli/basecliappprotocolhandler.h (modified) (1 diff)
-
thelib/include/protocols/cli/inboundbasecliprotocol.h (modified) (1 diff)
-
thelib/include/protocols/cli/inboundjsoncliprotocol.h (modified) (1 diff)
-
thelib/include/protocols/liveflv/innetliveflvstream.h (modified) (1 diff)
-
thelib/include/protocols/protocoltypes.h (modified) (2 diffs)
-
thelib/include/protocols/rtmp/basertmpappprotocolhandler.h (modified) (1 diff)
-
thelib/include/protocols/rtmp/basertmpprotocol.h (modified) (1 diff)
-
thelib/include/protocols/rtmp/streaming/baseoutnetrtmpstream.h (modified) (3 diffs)
-
thelib/include/protocols/rtmp/streaming/infilertmpstream.h (modified) (3 diffs)
-
thelib/include/protocols/rtmp/streaming/innetrtmpstream.h (modified) (1 diff)
-
thelib/include/protocols/rtmp/streaming/outfilertmpflvstream.h (modified) (1 diff)
-
thelib/include/protocols/rtmp/streaming/outnetrtmp4rtmpstream.h (modified) (2 diffs)
-
thelib/include/protocols/rtmp/streaming/outnetrtmp4tsstream.h (modified) (1 diff)
-
thelib/include/protocols/rtmp/streaming/rtmpstream.h (modified) (2 diffs)
-
thelib/include/protocols/tcpprotocol.h (modified) (1 diff)
-
thelib/include/protocols/ts/innettsstream.h (modified) (2 diffs)
-
thelib/include/streaming/baseinfilestream.h (modified) (10 diffs)
-
thelib/include/streaming/streamcapabilities.h (modified) (4 diffs)
-
thelib/include/streaming/streamstypes.h (modified) (3 diffs)
-
thelib/src/configuration/configfile.cpp (modified) (2 diffs)
-
thelib/src/mediaformats/mp4/atomdata.cpp (modified) (1 diff)
-
thelib/src/mediaformats/mp4/generateatom.sh (modified) (1 diff)
-
thelib/src/netio/select/iohandlermanager.cpp (modified) (1 diff)
-
thelib/src/protocols/baseprotocol.cpp (modified) (2 diffs)
-
thelib/src/protocols/cli/basecliappprotocolhandler.cpp (modified) (2 diffs)
-
thelib/src/protocols/cli/inboundbasecliprotocol.cpp (modified) (1 diff)
-
thelib/src/protocols/liveflv/innetliveflvstream.cpp (modified) (1 diff)
-
thelib/src/protocols/protocolfactorymanager.cpp (modified) (1 diff)
-
thelib/src/protocols/rtmp/basertmpprotocol.cpp (modified) (1 diff)
-
thelib/src/protocols/rtmp/messagefactories/connectionmessagefactory.cpp (modified) (3 diffs)
-
thelib/src/protocols/rtmp/rtmpprotocolserializer.cpp (modified) (5 diffs)
-
thelib/src/protocols/rtmp/streaming/baseoutnetrtmpstream.cpp (modified) (11 diffs)
-
thelib/src/protocols/rtmp/streaming/infilertmpstream.cpp (modified) (4 diffs)
-
thelib/src/protocols/rtmp/streaming/innetrtmpstream.cpp (modified) (3 diffs)
-
thelib/src/protocols/rtmp/streaming/outfilertmpflvstream.cpp (modified) (1 diff)
-
thelib/src/protocols/rtmp/streaming/outnetrtmp4rtmpstream.cpp (modified) (1 diff)
-
thelib/src/protocols/rtmp/streaming/outnetrtmp4tsstream.cpp (modified) (1 diff)
-
thelib/src/protocols/rtmp/streaming/rtmpstream.cpp (modified) (2 diffs)
-
thelib/src/protocols/rtp/basertspappprotocolhandler.cpp (modified) (1 diff)
-
thelib/src/protocols/rtp/sdp.cpp (modified) (2 diffs)
-
thelib/src/protocols/rtp/streaming/innetrtpstream.cpp (modified) (4 diffs)
-
thelib/src/protocols/ts/innettsstream.cpp (modified) (10 diffs)
-
thelib/src/streaming/baseinfilestream.cpp (modified) (4 diffs)
-
thelib/src/streaming/streamcapabilities.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/crtmpserver/src/crtmpserver.cpp
r702 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 69 69 #endif 70 70 71 int main(int argc, c har **argv) {71 int main(int argc, const char **argv) { 72 72 SRAND(); 73 73 InitNetworking(); -
trunk/sources/thelib/include/mediaformats/mp4/atomdata.h
r10 r734 41 41 42 42 virtual bool Read(); 43 st d::string Hierarchy(uint32_t indent);43 string Hierarchy(uint32_t indent); 44 44 }; 45 45 -
trunk/sources/thelib/include/mediaformats/mp4/generateatom.sh
r2 r734 44 44 echo "" >>$FILENAME 45 45 echo " virtual bool Read();" >>$FILENAME 46 echo " st d::string Hierarchy(uint32_t indent);" >>$FILENAME46 echo " string Hierarchy(uint32_t indent);" >>$FILENAME 47 47 echo "};" >>$FILENAME 48 48 echo "" >>$FILENAME -
trunk/sources/thelib/include/netio/fdstats.h
r722 r734 36 36 #endif /* GLOBALLY_ACCOUNT_BYTES */ 37 37 38 class BaseFdStats {38 class DLLEXP BaseFdStats { 39 39 private: 40 40 int64_t _current; … … 95 95 }; 96 96 97 class FdStats {97 class DLLEXP FdStats { 98 98 private: 99 99 BaseFdStats _managedTcp; -
trunk/sources/thelib/include/netio/netio.h
r706 r734 82 82 #endif 83 83 84 #ifdef NET_IOCP285 #include "netio/iocp2/iohandler.h"86 #include "netio/iocp2/iohandlermanager.h"87 #include "netio/iocp2/iohandlermanagertoken.h"88 #include "netio/iocp2/iotimer.h"89 #include "netio/iocp2/tcpacceptor.h"90 #include "netio/iocp2/tcpcarrier.h"91 #include "netio/iocp2/udpcarrier.h"92 #include "netio/iocp2/tcpconnector.h"93 #include "netio/iocp2/stdiocarrier.h"94 #define NETWORK_REACTOR "iocp2"95 #endif96 97 84 #endif /* _NETIO_H */ 98 85 -
trunk/sources/thelib/include/protocols/cli/basecliappprotocolhandler.h
r397 r734 37 37 virtual bool ProcessMessage(BaseProtocol *pFrom, Variant &message) = 0; 38 38 protected: 39 bool Send(BaseProtocol *pTo, string status, string description, Variant &data); 40 bool SendFail(BaseProtocol *pTo, string description); 41 bool SendSuccess(BaseProtocol *pTo, string description, Variant &data); 39 static bool SendFail(BaseProtocol *pTo, string description); 40 static bool SendSuccess(BaseProtocol *pTo, string description, Variant &data); 41 private: 42 static bool Send(BaseProtocol *pTo, string status, string description, Variant &data); 42 43 }; 43 44 -
trunk/sources/thelib/include/protocols/cli/inboundbasecliprotocol.h
r191 r734 26 26 class BaseCLIAppProtocolHandler; 27 27 28 class InboundBaseCLIProtocol28 class DLLEXP InboundBaseCLIProtocol 29 29 : public BaseProtocol { 30 30 private: -
trunk/sources/thelib/include/protocols/cli/inboundjsoncliprotocol.h
r210 r734 25 25 #include "protocols/cli/inboundbasecliprotocol.h" 26 26 27 class InboundJSONCLIProtocol27 class DLLEXP InboundJSONCLIProtocol 28 28 : public InboundBaseCLIProtocol { 29 29 private: -
trunk/sources/thelib/include/protocols/liveflv/innetliveflvstream.h
r694 r734 25 25 #include "streaming/baseinnetstream.h" 26 26 27 class InNetLiveFLVStream27 class DLLEXP InNetLiveFLVStream 28 28 : public BaseInNetStream { 29 29 private: -
trunk/sources/thelib/include/protocols/protocoltypes.h
r696 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 80 80 #define PT_INBOUND_RAW_HTTP_STREAM MAKE_TAG4('I','R','H','S') 81 81 82 //pass through protocol 83 #define PT_PASSTHROUGH MAKE_TAG2('P','T') 84 82 85 #endif /* _PROTOCOLTYPES_H */ 83 86 -
trunk/sources/thelib/include/protocols/rtmp/basertmpappprotocolhandler.h
r722 r734 27 27 #include "protocols/rtmp/rtmpprotocolserializer.h" 28 28 #include "protocols/rtmp/sharedobjects/somanager.h" 29 #include "streaming/baseoutstream.h"30 #include "streaming/baseoutfilestream.h"31 29 32 30 class OutboundRTMPProtocol; -
trunk/sources/thelib/include/protocols/rtmp/basertmpprotocol.h
r718 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) -
trunk/sources/thelib/include/protocols/rtmp/streaming/baseoutnetrtmpstream.h
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 35 35 uint32_t _chunkSize; 36 36 BaseRTMPProtocol *_pRTMPProtocol; 37 38 double _deltaVideoTime;39 double _deltaAudioTime;40 double *_pDeltaVideoTime;41 double *_pDeltaAudioTime;42 37 double _seekTime; 38 double _start; 43 39 44 40 uint32_t _isFirstVideoFrame; … … 114 110 bool AllowExecution(uint32_t totalProcessed, uint32_t dataLength, bool isAudio); 115 111 void InternalReset(); 116 void FixTimeBase();117 112 }; 118 113 -
trunk/sources/thelib/include/protocols/rtmp/streaming/infilertmpstream.h
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 4 * 5 5 * This file is part of crtmpserver. 6 6 * crtmpserver is free software: you can redistribute it and/or modify … … 8 8 * the Free Software Foundation, either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * crtmpserver is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. … … 100 100 virtual ~InFileRTMPStream(); 101 101 102 virtual bool Initialize(int32_t clientSideBufferLength );102 virtual bool Initialize(int32_t clientSideBufferLength, bool hasTimer); 103 103 104 104 virtual bool FeedData(uint8_t *pData, uint32_t dataLength, -
trunk/sources/thelib/include/protocols/rtmp/streaming/innetrtmpstream.h
r718 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) -
trunk/sources/thelib/include/protocols/rtmp/streaming/outfilertmpflvstream.h
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) -
trunk/sources/thelib/include/protocols/rtmp/streaming/outnetrtmp4rtmpstream.h
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 4 * 5 5 * This file is part of crtmpserver. 6 6 * crtmpserver is free software: you can redistribute it and/or modify … … 8 8 * the Free Software Foundation, either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * crtmpserver is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. -
trunk/sources/thelib/include/protocols/rtmp/streaming/outnetrtmp4tsstream.h
r729 r734 39 39 virtual ~OutNetRTMP4TSStream(); 40 40 41 virtual void SignalAttachedToInStream();42 43 41 virtual bool IsCompatibleWithType(uint64_t type); 44 42 -
trunk/sources/thelib/include/protocols/rtmp/streaming/rtmpstream.h
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 4 * 5 5 * This file is part of crtmpserver. 6 6 * crtmpserver is free software: you can redistribute it and/or modify … … 8 8 * the Free Software Foundation, either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * crtmpserver is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. -
trunk/sources/thelib/include/protocols/tcpprotocol.h
r496 r734 26 26 class IOHandler; 27 27 28 class TCPProtocol28 class DLLEXP TCPProtocol 29 29 : public BaseProtocol { 30 30 private: -
trunk/sources/thelib/include/protocols/ts/innettsstream.h
r729 r734 43 43 #endif 44 44 IOBuffer _audioBucket; 45 double _lastGotAudioTimestamp;46 45 double _lastSentAudioTimestamp; 47 46 uint64_t _audioPacketsCount; … … 68 67 69 68 StreamCapabilities _streamCapabilities; 70 71 double _deltaTime;72 69 73 70 IOBuffer _SPS; -
trunk/sources/thelib/include/streaming/baseinfilestream.h
r594 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 35 35 @class BaseInFileStream 36 36 @brief 37 */37 */ 38 38 class DLLEXP BaseInFileStream 39 39 : public BaseInStream { … … 78 78 bool _paused; 79 79 bool _audioVideoCodecsSent; 80 80 81 81 //seek offsets 82 82 uint64_t _seekBaseOffset; 83 83 uint64_t _framesBaseOffset; 84 84 uint64_t _timeToIndexOffset; 85 85 86 86 //stream capabilities 87 87 StreamCapabilities _streamCapabilities; 88 88 89 89 //when to stop playback 90 90 double _playLimit; … … 94 94 virtual ~BaseInFileStream(); 95 95 96 bool StreamCompleted(); 97 96 98 /*! 97 99 @brief Returns the stream capabilities. Specifically, codec and codec related info 98 */100 */ 99 101 virtual StreamCapabilities * GetCapabilities(); 100 102 … … 102 104 @brief Extracts the complete metadata from partial metadata 103 105 @param metaData - the partial metadata containing at least the media file name 104 */106 */ 105 107 static bool ResolveCompleteMetadata(Variant &metaData); 106 108 … … 108 110 @brief This will initialize the stream internally. 109 111 @param clientSideBufferLength - the client side buffer length expressed in seconds 110 */111 virtual bool Initialize(int32_t clientSideBufferLength );112 */ 113 virtual bool Initialize(int32_t clientSideBufferLength, bool hasTimer); 112 114 113 115 /*! 114 116 @brief Called when a play command was issued 115 117 @param absoluteTimestamp - the timestamp where we want to seek before start the feeding process 116 */118 */ 117 119 virtual bool SignalPlay(double &absoluteTimestamp, double &length); 118 120 119 121 /*! 120 122 @brief Called when a pasue command was issued 121 */123 */ 122 124 virtual bool SignalPause(); 123 125 124 126 /*! 125 127 @brief Called when a resume command was issued 126 */128 */ 127 129 virtual bool SignalResume(); 128 130 … … 130 132 @brief Called when a seek command was issued 131 133 @param absoluteTimestamp 132 */134 */ 133 135 virtual bool SignalSeek(double &absoluteTimestamp); 134 136 135 137 /*! 136 138 @brief Called when a stop command was issued 137 */139 */ 138 140 virtual bool SignalStop(); 139 141 140 142 /*! 141 143 @brief This is called by the framework. The networking layer signaled the availability for sending data 142 */144 */ 143 145 virtual void ReadyForSend(); 144 146 … … 151 153 @brief This will seek to the specified point in time. 152 154 @param absoluteTimestamp - the timestamp where we want to seek before start the feeding process 153 */155 */ 154 156 bool InternalSeek(double &absoluteTimestamp); 155 157 158 public: 156 159 /*! 157 160 @brief This is the function that will actually do the feeding. 158 161 @discussion It is called by the framework and it must deliver one frame at a time to all subscribers 159 */ 162 */ 163 160 164 virtual bool Feed(); 161 165 private: 162 166 /*! 163 167 @brief GetFile function will open a file and will cache it if is a regular file. … … 165 169 ReleaseFile will do the opposite: It will close the file if the references 166 170 count will reach 0. This always happens in case of mmap file 167 */171 */ 168 172 #ifdef HAS_MMAP 169 173 static MmapFile* GetFile(string filePath, uint32_t windowSize); … … 176 180 /*! 177 181 @brief This function will ensure that the codec packets are sent. Also it preserves the current timings and frame index 178 */182 */ 179 183 bool SendCodecs(); 180 184 }; -
trunk/sources/thelib/include/streaming/streamcapabilities.h
r598 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 39 39 DLLEXP _VIDEO_AVC(); 40 40 DLLEXP virtual ~_VIDEO_AVC(); 41 bool Init( uint8_t *pSPS, uint32_t spsLength,uint8_t *pPPS, uint32_t ppsLength);41 bool Init(const uint8_t *pSPS, uint32_t spsLength, const uint8_t *pPPS, uint32_t ppsLength); 42 42 void Clear(); 43 43 … … 57 57 DLLEXP _AUDIO_AAC(); 58 58 DLLEXP virtual ~_AUDIO_AAC(); 59 bool Init( uint8_t *pBuffer, uint32_t length);59 bool Init(const uint8_t *pBuffer, uint32_t length); 60 60 void Clear(); 61 61 DLLEXP string GetRTSPFmtpConfig(); … … 77 77 virtual ~StreamCapabilities(); 78 78 79 bool InitAudioAAC( uint8_t *pBuffer, uint32_t length);79 bool InitAudioAAC(const uint8_t *pBuffer, uint32_t length); 80 80 bool InitAudioADTS(); 81 81 bool InitAudioMP3(); 82 bool InitVideoH264( uint8_t *pSPS, uint32_t spsLength,uint8_t *pPPS,82 bool InitVideoH264(const uint8_t *pSPS, uint32_t spsLength, const uint8_t *pPPS, 83 83 uint32_t ppsLength); 84 84 -
trunk/sources/thelib/include/streaming/streamstypes.h
r497 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 32 32 #define ST_IN_NET_AAC MAKE_TAG3('I','N','A') 33 33 #define ST_IN_NET_MP3 MAKE_TAG3('I','N','M') 34 #define ST_IN_NET_EXT MAKE_TAG5('I','N','E','X','T') 35 #define ST_IN_NET_PASSTHROUGH MAKE_TAG3('I','N','S') 34 36 #define ST_IN_FILE MAKE_TAG2('I','F') 35 37 #define ST_IN_FILE_RTMP MAKE_TAG3('I','F','R') … … 41 43 #define ST_OUT_NET_RTP MAKE_TAG3('O','N','P') 42 44 #define ST_OUT_NET_RAW MAKE_TAG3('O','N','W') 45 #define ST_OUT_NET_TS MAKE_TAG4('O','N','T','S') 46 #define ST_OUT_NET_PASSTHROUGH MAKE_TAG3('O','N','S') 43 47 #define ST_OUT_FILE MAKE_TAG2('O','F') 44 48 #define ST_OUT_FILE_RTMP MAKE_TAG3('O','F','R') 45 49 #define ST_OUT_FILE_RTMP_FLV MAKE_TAG6('O','F','R','F','L','V') 46 50 #define ST_OUT_FILE_HLS MAKE_TAG5('O','F','H','L','S') 51 #define ST_OUT_FILE_HDS MAKE_TAG5('O','F','H','D','S') 47 52 48 53 #endif /* _STREAMSTYPES_H */ -
trunk/sources/thelib/src/configuration/configfile.cpp
r690 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 165 165 } 166 166 167 for (int32_t i = 0; i < instancesCount; i++) {168 pid_t pid = fork();169 if (pid < 0) {170 FATAL("Unable to start child instance. fork() failed");171 return false;172 }173 174 if (pid == 0) {175 _isOrigin = false;176 Logger::SignalFork();177 break;178 }179 }180 181 167 FOR_MAP(_modules, string, Module, i) { 182 168 MAP_VAL(i).config["isOrigin"] = (bool)_isOrigin; -
trunk/sources/thelib/src/mediaformats/mp4/atomdata.cpp
r413 r734 143 143 } 144 144 145 st d::string AtomDATA::Hierarchy(uint32_t indent) {146 return st d::string(4 * indent, ' ') + GetTypeString();145 string AtomDATA::Hierarchy(uint32_t indent) { 146 return string(4 * indent, ' ') + GetTypeString(); 147 147 } 148 148 -
trunk/sources/thelib/src/mediaformats/mp4/generateatom.sh
r2 r734 47 47 echo "}" >>$FILENAME 48 48 echo "" >>$FILENAME 49 echo "st d::string $CLASSNAME::Hierarchy(uint32_t indent) {" >>$FILENAME50 echo " return st d::string(4 * indent, ' ') + GetTypeString();" >>$FILENAME49 echo "string $CLASSNAME::Hierarchy(uint32_t indent) {" >>$FILENAME 50 echo " return string(4 * indent, ' ') + GetTypeString();" >>$FILENAME 51 51 echo "}" >>$FILENAME 52 52 echo "" >>$FILENAME -
trunk/sources/thelib/src/netio/select/iohandlermanager.cpp
r712 r734 257 257 258 258 bool IOHandlerManager::UpdateFdSets(int32_t fd) { 259 if( fd == 0 ) 260 return true; 259 261 uint8_t state = 0; 260 262 -
trunk/sources/thelib/src/protocols/baseprotocol.cpp
r705 r734 52 52 BaseProtocol::~BaseProtocol() { 53 53 #ifdef LOG_CONSTRUCTOR_DESTRUCTOR 54 FINEST("Protocol with id %u of type %s going to be deleted; F: %p,N: %p, DF: %hhu, DN: %hhu", 55 _id, STR(tagToString(_type)), 56 _pFarProtocol, _pNearProtocol, _deleteFar, _deleteNear); 54 FINEST("Protocol with id %"PRIu32"(%p) of type %s going to be deleted; F: %p,N: %p, DF: %"PRIu8", DN: %"PRIu8, 55 _id, 56 this, 57 STR(tagToString(_type)), 58 _pFarProtocol, 59 _pNearProtocol, 60 _deleteFar, 61 _deleteNear); 57 62 #endif 58 63 BaseProtocol *pFar = _pFarProtocol; … … 74 79 } 75 80 #ifdef LOG_CONSTRUCTOR_DESTRUCTOR 76 FINEST("Protocol with id %u of type %s deleted; F: %p,N: %p, DF: %hhu, DN: %hhu", 77 _id, STR(tagToString(_type)), 78 _pFarProtocol, _pNearProtocol, _deleteFar, _deleteNear); 81 FINEST("Protocol with id %"PRIu32"(%p) of type %s deleted; F: %p,N: %p, DF: %"PRIu8", DN: %"PRIu8, 82 _id, 83 this, 84 STR(tagToString(_type)), 85 _pFarProtocol, 86 _pNearProtocol, 87 _deleteFar, 88 _deleteNear); 79 89 #endif 80 90 ProtocolManager::UnRegisterProtocol(this); -
trunk/sources/thelib/src/protocols/cli/basecliappprotocolhandler.cpp
r560 r734 38 38 } 39 39 40 bool BaseCLIAppProtocolHandler::SendFail(BaseProtocol *pTo, string description) { 41 Variant dummy; 42 return Send(pTo, "FAIL", description, dummy); 43 } 44 45 bool BaseCLIAppProtocolHandler::SendSuccess(BaseProtocol *pTo, string description, Variant &data) { 46 return Send(pTo, "SUCCESS", description, data); 47 } 48 40 49 bool BaseCLIAppProtocolHandler::Send(BaseProtocol *pTo, string status, string description, Variant &data) { 50 if (pTo == NULL) 51 return true; 41 52 //1. Prepare the final message 42 53 Variant message; … … 54 65 } 55 66 } 56 57 bool BaseCLIAppProtocolHandler::SendFail(BaseProtocol *pTo, string description) {58 Variant dummy;59 return Send(pTo, "FAIL", description, dummy);60 }61 62 bool BaseCLIAppProtocolHandler::SendSuccess(BaseProtocol *pTo, string description, Variant &data) {63 return Send(pTo, "SUCCESS", description, data);64 }65 66 67 #endif /* HAS_PROTOCOL_CLI */ -
trunk/sources/thelib/src/protocols/cli/inboundbasecliprotocol.cpp
r471 r734 18 18 */ 19 19 20 #include "netio/kqueue/iohandlermanager.h"21 22 23 20 #ifdef HAS_PROTOCOL_CLI 24 21 #include "protocols/cli/inboundbasecliprotocol.h" 25 22 #include "application/clientapplicationmanager.h" 26 23 #include "protocols/cli/basecliappprotocolhandler.h" 24 #include "netio/netio.h" 27 25 28 26 InboundBaseCLIProtocol::InboundBaseCLIProtocol(uint64_t type) -
trunk/sources/thelib/src/protocols/liveflv/innetliveflvstream.cpp
r695 r734 109 109 info["audio"]["bytesCount"] = _audioBytesCount; 110 110 info["audio"]["packetsCount"] = _audioPacketsCount; 111 info["audio"]["droppedPacketsCount"] = 0;111 info["audio"]["droppedPacketsCount"] = (uint32_t) 0; 112 112 info["video"]["bytesCount"] = _videoBytesCount; 113 113 info["video"]["packetsCount"] = _videoPacketsCount; 114 info["video"]["droppedPacketsCount"] = 0;114 info["video"]["droppedPacketsCount"] = (uint32_t) 0; 115 115 } 116 116 -
trunk/sources/thelib/src/protocols/protocolfactorymanager.cpp
r413 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) -
trunk/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp
r722 r734 508 508 return NULL; 509 509 } 510 bool hasTimer = true; 511 if (metadata.HasKeyChain(V_BOOL, true, 1, "hasTimer")) 512 hasTimer = (bool)metadata["hasTimer"]; 510 513 if (!pRTMPInFileStream->Initialize( 511 (int32_t) metadata[CONF_APPLICATION_CLIENTSIDEBUFFER] )) {514 (int32_t) metadata[CONF_APPLICATION_CLIENTSIDEBUFFER], hasTimer)) { 512 515 FATAL("Unable to initialize file inbound stream"); 513 516 delete pRTMPInFileStream; -
trunk/sources/thelib/src/protocols/rtmp/messagefactories/connectionmessagefactory.cpp
r422 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 4 * 5 5 * This file is part of crtmpserver. 6 6 * crtmpserver is free software: you can redistribute it and/or modify … … 8 8 * the Free Software Foundation, either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * crtmpserver is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. … … 128 128 Variant ConnectionMessageFactory::GetInvokeConnectError(Variant request, 129 129 string decription, string level, string code) { 130 double objectEncoding = 0;131 if (M_INVOKE_PARAM(request, 0).HasKey(RM_INVOKE_PARAMS_RESULT_OBJECTENCODING))132 objectEncoding = M_INVOKE_PARAM(request, 0)[RM_INVOKE_PARAMS_RESULT_OBJECTENCODING];133 130 return GetInvokeConnectError( 134 131 VH_CI(request), -
trunk/sources/thelib/src/protocols/rtmp/rtmpprotocolserializer.cpp
r693 r734 577 577 { 578 578 AMF_CHECK_BOUNDARIES(buffer, 4); 579 message[RM_USRCTRL_STREAMID] = ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG---579 message[RM_USRCTRL_STREAMID] = (uint32_t) ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG--- 580 580 if (!buffer.Ignore(4)) { 581 581 FATAL("Unable to ignore 4 bytes"); … … 587 587 { 588 588 AMF_CHECK_BOUNDARIES(buffer, 8); 589 message[RM_USRCTRL_STREAMID] = ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG---589 message[RM_USRCTRL_STREAMID] = (uint32_t) ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG--- 590 590 if (!buffer.Ignore(4)) { 591 591 FATAL("Unable to ignore 4 bytes"); 592 592 return false; 593 593 } 594 message[RM_USRCTRL_BUFFLEN] = ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG---594 message[RM_USRCTRL_BUFFLEN] = (uint32_t) ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG--- 595 595 if (!buffer.Ignore(4)) { 596 596 FATAL("Unable to ignore 4 bytes"); … … 602 602 { 603 603 AMF_CHECK_BOUNDARIES(buffer, 4); 604 message[RM_USRCTRL_PING] = ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG---604 message[RM_USRCTRL_PING] = (uint32_t) ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG--- 605 605 if (!buffer.Ignore(4)) { 606 606 FATAL("Unable to ignore 4 bytes"); … … 612 612 { 613 613 AMF_CHECK_BOUNDARIES(buffer, 4); 614 message[RM_USRCTRL_PONG] = ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG---614 message[RM_USRCTRL_PONG] = (uint32_t) ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG--- 615 615 if (!buffer.Ignore(4)) { 616 616 FATAL("Unable to ignore 4 bytes"); … … 623 623 { 624 624 AMF_CHECK_BOUNDARIES(buffer, 4); 625 message[RM_USRCTRL_UNKNOWN_U32] = ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG---625 message[RM_USRCTRL_UNKNOWN_U32] = (uint32_t) ENTOHLP(GETIBPOINTER(buffer)); //----MARKED-LONG--- 626 626 if (!buffer.Ignore(4)) { 627 627 FATAL("Unable to ignore 4 bytes"); -
trunk/sources/thelib/src/protocols/rtmp/streaming/baseoutnetrtmpstream.cpp
r722 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 98 98 } else if (TAG_KIND_OF(inStreamType, ST_IN_NET_TS) 99 99 || TAG_KIND_OF(inStreamType, ST_IN_NET_RTP) 100 || TAG_KIND_OF(inStreamType, ST_IN_NET_AAC)) { 100 || TAG_KIND_OF(inStreamType, ST_IN_NET_AAC) 101 || TAG_KIND_OF(inStreamType, ST_IN_NET_EXT)) { 101 102 pResult = new OutNetRTMP4TSStream(pProtocol, pStreamsManager, name, 102 103 rtmpStreamId, chunkSize); … … 173 174 uint32_t processedLength, uint32_t totalLength, 174 175 double absoluteTimestamp, bool isAudio) { 176 if (_start < 0) 177 _start = absoluteTimestamp; 178 absoluteTimestamp -= _start; 175 179 if (_paused) 176 180 return true; … … 191 195 } 192 196 193 if ((*_pDeltaAudioTime) < 0) 194 (*_pDeltaAudioTime) = absoluteTimestamp; 195 if ((*_pDeltaAudioTime) > absoluteTimestamp) { 196 //FINEST("A: WAIT: D: %.2f", (*_pDeltaAudioTime) - absoluteTimestamp); 197 _pRTMPProtocol->EnqueueForOutbound(); 198 return true; 199 } 200 201 H_IA(_audioHeader) = true; 202 H_TS(_audioHeader) = (uint32_t) (absoluteTimestamp - (*_pDeltaAudioTime) + _seekTime); 203 if ((pData[0] >> 4) == 10 204 && (pData[1] == 0)) { 197 if ((pData[0] >> 4) == 10 && (pData[1] == 0)) { 205 198 //AAC codec setup. Keep _isFirstAudioFrame == true; 206 199 _isFirstAudioFrame = true; 200 if (absoluteTimestamp < 0) { 201 //WARN("negative A. Force it to 0 because is a codec setup"); 202 absoluteTimestamp = 0; 203 } 207 204 } else { 208 205 //not AAC codec setup 206 if (absoluteTimestamp < 0) { 207 //WARN("negative A and not a codec. Drop it"); 208 _pRTMPProtocol->EnqueueForOutbound(); 209 return true; 210 } 209 211 _isFirstAudioFrame = false; 210 212 } 213 214 H_IA(_audioHeader) = true; 215 H_TS(_audioHeader) = (uint32_t) (absoluteTimestamp + _seekTime); 211 216 } else { 212 217 ALLOW_EXECUTION(processedLength, dataLength, isAudio); 213 218 H_IA(_audioHeader) = false; 214 219 if (processedLength == 0) 215 H_TS(_audioHeader) = (uint32_t) ((absoluteTimestamp - (*_pDeltaAudioTime)+ _seekTime)220 H_TS(_audioHeader) = (uint32_t) ((absoluteTimestamp + _seekTime) 216 221 - _pChannelAudio->lastOutAbsTs); 217 222 } … … 247 252 } 248 253 249 if ((*_pDeltaVideoTime) < 0) 250 (*_pDeltaVideoTime) = absoluteTimestamp; 251 if ((*_pDeltaVideoTime) > absoluteTimestamp) { 252 //FINEST("V: WAIT: D: %.2f", (*_pDeltaVideoTime) - absoluteTimestamp); 253 _pRTMPProtocol->EnqueueForOutbound(); 254 return true; 255 } 256 257 H_IA(_videoHeader) = true; 258 H_TS(_videoHeader) = (uint32_t) (absoluteTimestamp - (*_pDeltaVideoTime) + _seekTime); 259 260 if ((pData[0] == 0x17) //AVC keyframe 261 && (pData[1] == 0)) { //codec setup 254 if ((pData[0] == 0x17) && (pData[1] == 0)) { 262 255 // h264 codec setup. Keep _isFirstVideoFrame == true 263 256 _isFirstVideoFrame = true; 257 if (absoluteTimestamp < 0) { 258 //WARN("negative V. Force it to 0 because is a codec setup"); 259 absoluteTimestamp = 0; 260 } 264 261 } else { 265 262 //not h264 codec setup 263 if (absoluteTimestamp < 0) { 264 //WARN("negative V and not a codec. Drop it"); 265 _pRTMPProtocol->EnqueueForOutbound(); 266 return true; 267 } 266 268 _isFirstVideoFrame = false; 267 269 } 270 271 H_IA(_videoHeader) = true; 272 H_TS(_videoHeader) = (uint32_t) (absoluteTimestamp + _seekTime); 268 273 } else { 269 274 ALLOW_EXECUTION(processedLength, dataLength, isAudio); 270 275 H_IA(_videoHeader) = false; 271 276 if (processedLength == 0) 272 H_TS(_videoHeader) = (uint32_t) ((absoluteTimestamp - (*_pDeltaVideoTime)+ _seekTime)277 H_TS(_videoHeader) = (uint32_t) ((absoluteTimestamp + _seekTime) 273 278 - _pChannelVideo->lastOutAbsTs); 274 279 } … … 310 315 _feederChunkSize = 0xffffffff; 311 316 } 312 313 //3. Fix the time base314 FixTimeBase();315 316 317 317 318 //4. Store the metadata … … 511 512 bool BaseOutNetRTMPStream::SignalPlay(double &absoluteTimestamp, double &length) { 512 513 _paused = false; 513 514 514 return true; 515 515 } … … 546 546 547 547 bool BaseOutNetRTMPStream::SignalSeek(double &absoluteTimestamp) { 548 549 548 //1. Stream eof 550 549 Variant message = StreamMessageFactory::GetUserControlStreamEof(_rtmpStreamId); … … 650 649 InternalReset(); 651 650 652 FixTimeBase();653 654 651 _seekTime = absoluteTimestamp; 655 652 … … 863 860 || (_pChannelCommands == NULL)) 864 861 return; 865 _deltaAudioTime = -1; 866 _deltaVideoTime = -1; 867 _pDeltaAudioTime = &_deltaAudioTime; 868 _pDeltaVideoTime = &_deltaVideoTime; 862 _start = -1; 869 863 _seekTime = 0; 870 864 … … 894 888 } 895 889 } 896 897 void BaseOutNetRTMPStream::FixTimeBase() {898 //3. Fix the time base899 if (_pInStream != NULL) {900 uint64_t attachedStreamType = _pInStream->GetType();901 if ((TAG_KIND_OF(attachedStreamType, ST_IN_FILE_RTMP))902 || (TAG_KIND_OF(attachedStreamType, ST_IN_NET_RTMP))903 || (TAG_KIND_OF(attachedStreamType, ST_IN_NET_LIVEFLV))904 || (TAG_KIND_OF(attachedStreamType, ST_IN_NET_RTP))905 || (TAG_KIND_OF(attachedStreamType, ST_IN_NET_MP3))906 || (TAG_KIND_OF(attachedStreamType, ST_IN_NET_AAC))907 ) {908 //RTMP streams are having the same time base for audio and video909 _pDeltaAudioTime = &_deltaAudioTime;910 _pDeltaVideoTime = &_deltaAudioTime;911 } else {912 //otherwise consider them separate913 _pDeltaAudioTime = &_deltaAudioTime;914 _pDeltaVideoTime = &_deltaVideoTime;915 }916 } else {917 _pDeltaAudioTime = &_deltaAudioTime;918 _pDeltaVideoTime = &_deltaVideoTime;919 }920 }921 890 #endif /* HAS_PROTOCOL_RTMP */ 922 891 -
trunk/sources/thelib/src/protocols/rtmp/streaming/infilertmpstream.cpp
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 4 * 5 5 * This file is part of crtmpserver. 6 6 * crtmpserver is free software: you can redistribute it and/or modify … … 8 8 * the Free Software Foundation, either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * crtmpserver is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. … … 193 193 } 194 194 195 bool InFileRTMPStream::Initialize(int32_t clientSideBufferLength ) {195 bool InFileRTMPStream::Initialize(int32_t clientSideBufferLength, bool hasTimer) { 196 196 //1. Base init 197 if (!BaseInFileStream::Initialize(clientSideBufferLength )) {197 if (!BaseInFileStream::Initialize(clientSideBufferLength, hasTimer)) { 198 198 FATAL("Unable to initialize stream"); 199 199 return false; … … 249 249 250 250 bool InFileRTMPStream::IsCompatibleWithType(uint64_t type) { 251 return TAG_KIND_OF(type, ST_OUT_NET_RTMP); 251 return TAG_KIND_OF(type, ST_OUT_NET_RTMP) 252 || TAG_KIND_OF(type, ST_OUT_FILE_HLS); 252 253 } 253 254 -
trunk/sources/thelib/src/protocols/rtmp/streaming/innetrtmpstream.cpp
r718 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 68 68 || TAG_KIND_OF(type, ST_OUT_FILE_RTMP) 69 69 || TAG_KIND_OF(type, ST_OUT_NET_RTP) 70 || TAG_KIND_OF(type, ST_OUT_NET_TS) 70 71 || TAG_KIND_OF(type, ST_OUT_FILE_HLS); 72 71 73 } 72 74 … … 227 229 228 230 void InNetRTMPStream::SignalOutStreamDetached(BaseOutStream *pOutStream) { 229 FINEST("outbound stream %u detached from inbound stream %u",230 pOutStream->GetUniqueId(), GetUniqueId());231 //FINEST("outbound stream %u detached from inbound stream %u", 232 // pOutStream->GetUniqueId(), GetUniqueId()); 231 233 } 232 234 -
trunk/sources/thelib/src/protocols/rtmp/streaming/outfilertmpflvstream.cpp
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) -
trunk/sources/thelib/src/protocols/rtmp/streaming/outnetrtmp4rtmpstream.cpp
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) -
trunk/sources/thelib/src/protocols/rtmp/streaming/outnetrtmp4tsstream.cpp
r729 r734 44 44 } 45 45 46 void OutNetRTMP4TSStream::SignalAttachedToInStream() {47 if (_pInStream == NULL)48 return;49 if (_inboundStreamIsRTP && GetCapabilities() != NULL) {50 _videoCodecSent = (GetCapabilities()->videoCodecId != CODEC_VIDEO_AVC);51 }52 BaseOutNetRTMPStream::SignalAttachedToInStream();53 }54 55 46 bool OutNetRTMP4TSStream::IsCompatibleWithType(uint64_t type) { 56 _inboundStreamIsRTP = TAG_KIND_OF(type, ST_IN_NET_RTP) ;47 _inboundStreamIsRTP = TAG_KIND_OF(type, ST_IN_NET_RTP) || TAG_KIND_OF(type, ST_IN_NET_EXT); 57 48 _videoCodecSent = (type == ST_IN_NET_AAC); 58 49 return TAG_KIND_OF(type, ST_IN_NET_TS) 59 50 || TAG_KIND_OF(type, ST_IN_NET_RTP) 60 || TAG_KIND_OF(type, ST_IN_NET_AAC); 51 || TAG_KIND_OF(type, ST_IN_NET_AAC) 52 || TAG_KIND_OF(type, ST_IN_NET_EXT); 61 53 } 62 54 -
trunk/sources/thelib/src/protocols/rtmp/streaming/rtmpstream.cpp
r721 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 4 * 5 5 * This file is part of crtmpserver. 6 6 * crtmpserver is free software: you can redistribute it and/or modify … … 8 8 * the Free Software Foundation, either version 3 of the License, or 9 9 * (at your option) any later version. 10 * 10 * 11 11 * crtmpserver is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 * 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. -
trunk/sources/thelib/src/protocols/rtp/basertspappprotocolhandler.cpp
r714 r734 1657 1657 result += format("o=- %"PRIu32" 0 IN IP4 %s\r\n", pFrom->GetId(), STR(nearAddress)); 1658 1658 result += "s=" + targetStreamName + "\r\n"; 1659 result += "u= http://www.evostream.com\r\n";1659 result += "u=www.evostream.com\r\n"; 1660 1660 result += "e=contact@evostream.com\r\n"; 1661 1661 result += "c=IN IP4 " + nearAddress + "\r\n"; -
trunk/sources/thelib/src/protocols/rtp/sdp.cpp
r714 r734 503 503 504 504 vector<string> parts; 505 trim(line); 505 506 split(line, " ", parts); 506 507 if (parts.size() != 4) … … 536 537 537 538 if ((string) result["addressType"] != "IP4") { 538 FATAL("Unsupported address type: %s", STR(result["addressType"])); 539 return false; 539 if ((string) result["addressType"] != "IPV4") { 540 FATAL("Unsupported address type: %s", STR(result["addressType"])); 541 return false; 542 } else { 543 WARN("Tolerate IPV4 value inside line %s", STR(result["addressType"])); 544 result["addressType"] = "IP4"; 545 } 540 546 } 541 547 -
trunk/sources/thelib/src/protocols/rtp/streaming/innetrtpstream.cpp
r729 r734 81 81 _rtcpDetectionStart = 0; 82 82 83 _avCodecsSent =false;83 _avCodecsSent = false; 84 84 } 85 85 … … 93 93 bool InNetRTPStream::IsCompatibleWithType(uint64_t type) { 94 94 return (type == ST_OUT_NET_RTMP_4_TS) 95 || (type == ST_OUT_NET_TS) 95 96 || (type == ST_OUT_FILE_HLS) 97 || (type == ST_OUT_FILE_HDS) 96 98 || (type == ST_OUT_NET_RTP); 97 99 } … … 107 109 FeedVideoCodecSetup(pOutStream); 108 110 FeedAudioCodecSetup(pOutStream); 109 _avCodecsSent =true;111 _avCodecsSent = true; 110 112 } 111 113 } … … 113 115 if (_videoLastTs != 0) { 114 116 FeedVideoCodecSetup(pOutStream); 115 _avCodecsSent =true;117 _avCodecsSent = true; 116 118 } 117 119 if (_audioLastTs != 0) { 118 120 FeedAudioCodecSetup(pOutStream); 119 _avCodecsSent =true;121 _avCodecsSent = true; 120 122 } 121 123 } -
trunk/sources/thelib/src/protocols/ts/innettsstream.cpp
r729 r734 39 39 _dtsTimeAudio = 0; 40 40 #endif 41 _lastGotAudioTimestamp = 0;42 41 _lastSentAudioTimestamp = 0; 43 42 _audioPacketsCount = 0; … … 56 55 _dtsTimeVideo = 0; 57 56 #endif 58 59 _deltaTime = -1;60 57 _videoPacketsCount = 0; 61 58 _videoBytesCount = 0; … … 135 132 double &dtsTime = isAudio ? _dtsTimeAudio : _dtsTimeVideo; 136 133 #endif 137 double absoluteTime = 0;138 134 if (packetStart) { 139 135 if (isAudio) { … … 231 227 } 232 228 233 if (_deltaTime < 0)234 _deltaTime = ptsTime;235 236 absoluteTime = (ptsTime - _deltaTime);237 238 229 pData += 9 + pesHeaderLength; 239 230 length -= (9 + pesHeaderLength); … … 330 321 } 331 322 } 332 double timestamp = _ptsTimeAudio - _deltaTime; 333 if (_ptsTimeAudio < 0 || _deltaTime < 0 || timestamp < 0) { 323 if ((_ptsTimeAudio < 0) 324 || (GETAVAILABLEBYTESCOUNT(_audioBucket) < 2) 325 || (GETIBPOINTER(_audioBucket)[0] != 0xff) 326 || ((GETIBPOINTER(_audioBucket)[1] >> 4) != 0x0f) 327 ) { 334 328 _audioBucket.IgnoreAll(); 335 329 return true; … … 345 339 GETAVAILABLEBYTESCOUNT(_audioBucket)); 346 340 347 if (_lastGotAudioTimestamp != timestamp) { 348 _audioPacketsCount = 0; 349 } 350 _lastGotAudioTimestamp = timestamp; 341 _audioPacketsCount = 0; 351 342 352 343 for (;;) { … … 381 372 } 382 373 383 double ts = timestamp+ (((double) _audioPacketsCount * 1024.00) / (double) _streamCapabilities.aac._sampleRate)*1000.0;374 double ts = _ptsTimeAudio + (((double) _audioPacketsCount * 1024.00) / (double) _streamCapabilities.aac._sampleRate)*1000.0; 384 375 _audioPacketsCount++; 385 376 if (_lastSentAudioTimestamp >= ts) { … … 404 395 405 396 bool InNetTSStream::HandleVideoData() { 406 double timestamp = _ptsTimeVideo - _deltaTime; 407 if (_ptsTimeVideo < 0 || _deltaTime < 0 || timestamp < 0) { 397 if (_ptsTimeVideo < 0 || GETAVAILABLEBYTESCOUNT(_videoBucket) == 0) { 398 _videoDroppedPacketsCount++; 399 _videoDroppedBytesCount += GETAVAILABLEBYTESCOUNT(_videoBucket); 408 400 _videoBucket.IgnoreAll(); 409 401 return true; 410 402 } 403 _videoPacketsCount++; 404 _videoBytesCount += GETAVAILABLEBYTESCOUNT(_videoBucket); 411 405 412 406 uint32_t cursor = 0; … … 438 432 found = false; 439 433 if (pNalStart != NULL) { 440 if (!ProcessNal(pNalStart, pNalEnd - pNalStart, timestamp)) {434 if (!ProcessNal(pNalStart, pNalEnd - pNalStart, _ptsTimeVideo)) { 441 435 FATAL("Unable to process NAL"); 442 436 return false; … … 447 441 if (pNalStart != NULL) { 448 442 int32_t lastLength = length - (pNalStart - pBuffer); 449 if (!ProcessNal(pNalStart, lastLength, timestamp)) {443 if (!ProcessNal(pNalStart, lastLength, _ptsTimeVideo)) { 450 444 FATAL("Unable to process NAL"); 451 445 return false; -
trunk/sources/thelib/src/streaming/baseinfilestream.cpp
r617 r734 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 99 99 } 100 100 101 bool BaseInFileStream::StreamCompleted() { 102 if (_currentFrameIndex >= _totalFrames) 103 return true; 104 if ((_playLimit >= 0) && ((_playLimit < (double) _totalSentTime))) 105 return true; 106 return false; 107 } 108 101 109 StreamCapabilities * BaseInFileStream::GetCapabilities() { 102 110 return &_streamCapabilities; … … 168 176 } 169 177 170 bool BaseInFileStream::Initialize(int32_t clientSideBufferLength ) {178 bool BaseInFileStream::Initialize(int32_t clientSideBufferLength, bool hasTimer) { 171 179 //1. Check to see if we have an universal seeking file 172 180 string seekFilePath = GetName() + "."MEDIA_TYPE_SEEK; … … 251 259 252 260 //6. Create the timer 253 _pTimer = new InFileStreamTimer(this); 254 _pTimer->EnqueueForTimeEvent(_clientSideBufferLength - _clientSideBufferLength / 3); 261 if (hasTimer) { 262 _pTimer = new InFileStreamTimer(this); 263 _pTimer->EnqueueForTimeEvent(_clientSideBufferLength - _clientSideBufferLength / 3); 264 } 255 265 256 266 //7. Done -
trunk/sources/thelib/src/streaming/streamcapabilities.cpp
r665 r734 328 328 } 329 329 330 bool _VIDEO_AVC::Init( uint8_t *pSPS, uint32_t spsLength,uint8_t *pPPS,330 bool _VIDEO_AVC::Init(const uint8_t *pSPS, uint32_t spsLength, const uint8_t *pPPS, 331 331 uint32_t ppsLength) { 332 332 Clear(); … … 386 386 } 387 387 } 388 388 389 389 if (!ReadPPS(ppsBa, _PPSInfo)) { 390 390 WARN("Unable to read PPS info"); … … 484 484 } 485 485 486 bool _AUDIO_AAC::Init( uint8_t *pBuffer, uint32_t length) {486 bool _AUDIO_AAC::Init(const uint8_t *pBuffer, uint32_t length) { 487 487 Clear(); 488 488 //http://wiki.multimedia.cx/index.php?title=MP4A#Audio_Specific_Config … … 618 618 } 619 619 620 bool StreamCapabilities::InitAudioAAC( uint8_t *pBuffer, uint32_t length) {620 bool StreamCapabilities::InitAudioAAC(const uint8_t *pBuffer, uint32_t length) { 621 621 ClearAudio(); 622 622 if (!aac.Init(pBuffer, length)) { … … 640 640 } 641 641 642 bool StreamCapabilities::InitVideoH264( uint8_t *pSPS, uint32_t spsLength,643 uint8_t *pPPS, uint32_t ppsLength) {642 bool StreamCapabilities::InitVideoH264(const uint8_t *pSPS, uint32_t spsLength, 643 const uint8_t *pPPS, uint32_t ppsLength) { 644 644 ClearVideo(); 645 645 if (!avc.Init(pSPS, spsLength, pPPS, ppsLength)) {
Note: See TracChangeset
for help on using the changeset viewer.
