Changeset 74
- Timestamp:
- 08/13/10 20:05:31 (18 months ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
builders/androidapplestreaming/src/com/rtmpd/CommandsInterface.java (modified) (2 diffs)
-
builders/androidapplestreaming/src/com/rtmpd/MessageBase.java (modified) (1 diff)
-
builders/androidapplestreaming/src/com/rtmpd/MessageContextCreate.java (modified) (1 diff)
-
builders/androidapplestreaming/src/com/rtmpd/MessageContextList.java (modified) (1 diff)
-
builders/androidapplestreaming/src/com/rtmpd/MessageInfoListStreams.java (modified) (1 diff)
-
builders/cmake/androidapplestreaming/CMakeLists.txt (modified) (1 diff)
-
sources/androidapplestreaming/include/api.h (modified) (1 diff)
-
sources/androidapplestreaming/src/api.cpp (modified) (3 diffs)
-
sources/androidapplestreaming/src/jniwrapper.cpp (modified) (1 diff)
-
sources/androidapplestreaming/src/main.cpp (modified) (2 diffs)
-
sources/applications/applestreamingclient/include/clientcontext.h (modified) (1 diff)
-
sources/applications/applestreamingclient/include/protocols/variant/messagestructure.h (modified) (4 diffs)
-
sources/applications/applestreamingclient/include/protocols/variant/variantappprotocolhandler.h (modified) (1 diff)
-
sources/applications/applestreamingclient/src/clientcontext.cpp (modified) (4 diffs)
-
sources/applications/applestreamingclient/src/protocols/variant/variantappprotocolhandler.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/builders/androidapplestreaming/src/com/rtmpd/CommandsInterface.java
r63 r74 1 /* 2 * Copyright (c) 2010, 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 5 * This file is part of crtmpserver. 6 * crtmpserver is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * crtmpserver is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 1 20 package com.rtmpd; 2 21 … … 34 53 public native HashMap<Object, Object> InfoBandwidth(int contextId); 35 54 36 public native HashMap<Object, Object> InfoAllBandwidth();37 38 55 public native HashMap<Object, Object> InfoPlayback(int contextId); 39 40 public native HashMap<Object, Object> InfoAllPlayback();41 56 } 42 57 -
trunk/builders/androidapplestreaming/src/com/rtmpd/MessageBase.java
r31 r74 1 /* 2 * Copyright (c) 2010, 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 5 * This file is part of crtmpserver. 6 * crtmpserver is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * crtmpserver is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 1 20 package com.rtmpd; 2 21 -
trunk/builders/androidapplestreaming/src/com/rtmpd/MessageContextCreate.java
r31 r74 1 /* 2 * Copyright (c) 2010, 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 5 * This file is part of crtmpserver. 6 * crtmpserver is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * crtmpserver is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 1 20 package com.rtmpd; 2 21 -
trunk/builders/androidapplestreaming/src/com/rtmpd/MessageContextList.java
r31 r74 1 /* 2 * Copyright (c) 2010, 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 5 * This file is part of crtmpserver. 6 * crtmpserver is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * crtmpserver is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 1 20 package com.rtmpd; 2 21 -
trunk/builders/androidapplestreaming/src/com/rtmpd/MessageInfoListStreams.java
r32 r74 1 /* 2 * Copyright (c) 2010, 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) 4 * 5 * This file is part of crtmpserver. 6 * crtmpserver is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * crtmpserver is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with crtmpserver. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 1 20 package com.rtmpd; 2 21 -
trunk/builders/cmake/androidapplestreaming/CMakeLists.txt
r20 r74 4 4 #prepare the include directories 5 5 INCLUDE_DIRECTORIES( 6 ../../../3rdparty/lua-dev 6 7 ../../../sources/common/include 7 8 ../../../sources/thelib/include -
trunk/sources/androidapplestreaming/include/api.h
r63 r74 43 43 Variant InfoListAllStreams(); 44 44 Variant InfoBandwidth(uint32_t contextId); 45 Variant InfoAllBandwidth();46 45 Variant InfoPlayback(uint32_t contextId); 47 Variant InfoAllPlayback();48 46 49 47 #endif /* _API_H */ -
trunk/sources/androidapplestreaming/src/api.cpp
r63 r74 260 260 261 261 Variant InfoBandwidth(uint32_t contextId) { 262 /*263 * Variant CLIGetAvailableBandwidths();264 * Variant CLIGetMeasuredBandwidth();265 * Variant CLIGetSelectedBandwidth();266 */267 262 Variant request; 268 263 ASC_REQ_BUILD_INFO_BANDWIDTH(request, contextId); … … 272 267 } 273 268 274 Variant InfoAllBandwidth() {275 Variant request;276 ASC_REQ_BUILD_INFO_ALL_BANDWIDTH(request);277 Variant response;278 SEND_VARIANT_REQUEST(request, response);279 return response;280 }281 282 269 Variant InfoPlayback(uint32_t contextId) { 283 270 Variant request; … … 287 274 return response; 288 275 } 289 290 Variant InfoAllPlayback() {291 /*292 * Variant CLIGetSeekRange();293 * Variant CLIGetVideoChannels();294 * Variant CLIGetAudioChannels();295 */296 Variant request;297 ASC_REQ_BUILD_INFO_ALL_PLAYBACK(request);298 Variant response;299 SEND_VARIANT_REQUEST(request, response);300 return response;301 } -
trunk/sources/androidapplestreaming/src/jniwrapper.cpp
r63 r74 117 117 } 118 118 119 extern "C" jobject Java_com_rtmpd_CommandsInterface_InfoAllBandwidth(120 JNIEnv* pEnv, jobject thiz) {121 Variant result = InfoAllBandwidth();122 return VariantToJObject(result, pEnv);123 }124 125 119 extern "C" jobject Java_com_rtmpd_CommandsInterface_InfoPlayback( 126 120 JNIEnv* pEnv, jobject thiz, jint contextId) { 127 121 Variant result = InfoPlayback((uint32_t) contextId); 128 return VariantToJObject(result, pEnv);129 }130 131 extern "C" jobject Java_com_rtmpd_CommandsInterface_InfoAllPlayback(132 JNIEnv* pEnv, jobject thiz) {133 Variant result = InfoAllPlayback();134 122 return VariantToJObject(result, pEnv); 135 123 } -
trunk/sources/androidapplestreaming/src/main.cpp
r36 r74 78 78 } 79 79 80 #define MY_URL "http://mediadownloads.mlb.com/mlbam/2010/06/29/9505835_m3u8/128/dropf_9505835_100m_128K.m3u8" 81 #define MY_SESSION_ID "" 82 #define MY_KEY "" 80 //#define MY_URL "http://mediadownloads.mlb.com/mlbam/2010/06/29/9505835_m3u8/128/dropf_9505835_100m_128K.m3u8" 81 //#define MY_SESSION_ID "" 82 //#define MY_KEY "" 83 84 85 #define MY_URL "http://mlbvod-akc.mlb.com/mlbam/2010/04/08/MLB_GAME_VIDEO_LANPIT_HOME_20100408/master_wired.m3u8" 86 #define MY_SESSION_ID "playback=HTTP_CLOUD_WIRED&contentId=7320085&appAccountName=mlb&eventId=14-263849-2010-04-08&ipid=11627706&sessionKey=3HJ3abDj%2BPBkmIn8cprQTgkYIa8%3D" 87 #define MY_KEY "ugkuOk9Qy4HNS5uRxQcQXHfLuAI=" 83 88 84 89 void testCommands() { … … 89 94 result = CommandPlay(contextId, MY_URL, MY_SESSION_ID, MY_KEY); 90 95 FINEST("result:\n%s", STR(result.ToString())); 91 //sleep(1); 96 97 for (;;) { 98 result = InfoBandwidth(contextId); 99 FINEST("InfoBandwidth:\n%s", STR(result.ToString())); 100 // result = InfoPlayback(contextId); 101 // FINEST("InfoBandwidth:\n%s", STR(result.ToString())); 102 sleep(1); 103 } 92 104 93 105 // sleep(5); -
trunk/sources/applications/applestreamingclient/include/clientcontext.h
r56 r74 88 88 Playlist *MasterPlaylist(); 89 89 Playlist *ChildPlaylist(uint32_t bw); 90 vector<double> GetAvailableBandwidths(); 91 double GetDetectedBandwidth(); 92 double GetSelectedBandwidth(); 93 uint32_t GetBufferLevel(); 94 uint32_t GetMaxBufferLevel(); 95 double GetBufferLevelPercent(); 90 96 91 97 //processing -
trunk/sources/applications/applestreamingclient/include/protocols/variant/messagestructure.h
r63 r74 38 38 #define ASC_REQ_TYPE_INFO_LIST_ALL_STREAMS "infoListAllStreams" 39 39 #define ASC_REQ_TYPE_INFO_BANDWIDTH "infoBandwidth" 40 #define ASC_REQ_TYPE_INFO_ALL_BANDWIDTH "infoAllBandwidth"41 40 #define ASC_REQ_TYPE_INFO_PLAYBACK "infoPlayback" 42 #define ASC_REQ_TYPE_INFO_ALL_PLAYBACK "infoAllPlayback"43 41 44 42 #define ASC_REQ_COMMAND_PLAY_URI_KEY "uri" … … 50 48 #define ASC_REQ_COMMAND_SELECT_AV_CHANNELS_VIDEO "video" 51 49 52 #define ASC_RES_CONTEXT_CREATE_CONTEXT_ID_KEY "contextId" 50 #define ASC_RES_CONTEXT_CREATE_CONTEXT_ID_KEY "contextId" 51 #define ASC_RES_INFO_BANDWIDTH_AVAILABLE_BWS "availableBws" 52 #define ASC_RES_INFO_BANDWIDTH_DETECTED_BW "detectedBw" 53 #define ASC_RES_INFO_BANDWIDTH_SELECTED_BW "selectedBw" 54 #define ASC_RES_INFO_BANDWIDTH_BUFFER_LEVEL "bufferLevel" 55 #define ASC_RES_INFO_BANDWIDTH_MAX_BUFFER_LEVEL "bufferMaxLevel" 56 #define ASC_RES_INFO_BANDWIDTH_MAX_BUFFER_LEVEL_PERCENT "bufferLevelPercent" 53 57 54 58 #define ASC_RES_STATUS_OK 0 … … 163 167 ASC_REQ_BUILD(v,ASC_REQ_TYPE_INFO_BANDWIDTH,contextId,Variant()) 164 168 165 #define ASC_REQ_BUILD_INFO_ALL_BANDWIDTH(v) \166 ASC_REQ_BUILD(v,ASC_REQ_TYPE_INFO_ALL_BANDWIDTH,0,Variant())167 168 169 #define ASC_REQ_BUILD_INFO_PLAYBACK(v,contextId) \ 169 170 ASC_REQ_BUILD(v,ASC_REQ_TYPE_INFO_PLAYBACK,contextId,Variant()) 170 171 #define ASC_REQ_BUILD_INFO_ALL_PLAYBACK(v) \172 ASC_REQ_BUILD(v,ASC_REQ_TYPE_INFO_ALL_PLAYBACK,0,Variant())173 171 174 172 #define ASC_RES_BUILD(r,status,params) \ … … 264 262 ASC_RES_BUILD_OK_INFO_LIST_STREAMS(r,streamNames) 265 263 264 #define ASC_RES_BUILD_OK_INFO_BANDWIDTH(r,available, detected, selected, bufferLevel, maxBufferLevel, bufferLevelPercent) \ 265 do { \ 266 Variant params; \ 267 params[ASC_RES_INFO_BANDWIDTH_AVAILABLE_BWS].IsArray(true); \ 268 for(uint32_t i=0;i<available.size();i++) \ 269 params[ASC_RES_INFO_BANDWIDTH_AVAILABLE_BWS].PushToArray((double)available[i]); \ 270 params[ASC_RES_INFO_BANDWIDTH_DETECTED_BW]=(double)(detected); \ 271 params[ASC_RES_INFO_BANDWIDTH_SELECTED_BW]=(double)(selected); \ 272 params[ASC_RES_INFO_BANDWIDTH_BUFFER_LEVEL]=(uint32_t)(bufferLevel); \ 273 params[ASC_RES_INFO_BANDWIDTH_MAX_BUFFER_LEVEL]=(uint32_t)(maxBufferLevel); \ 274 params[ASC_RES_INFO_BANDWIDTH_MAX_BUFFER_LEVEL_PERCENT]=(double)(bufferLevelPercent); \ 275 ASC_RES_BUILD(r,ASC_RES_STATUS_OK,params); \ 276 } while(0) 277 266 278 #endif /* _MESSAGESTRUCTURE_H */ 267 279 -
trunk/sources/applications/applestreamingclient/include/protocols/variant/variantappprotocolhandler.h
r31 r74 44 44 void ProcessInfoListStreams(BaseVariantProtocol *pProtocol, Variant &request); 45 45 void ProcessInfoListAllStreams(BaseVariantProtocol *pProtocol, Variant &request); 46 void ProcessInfoBandwidth(BaseVariantProtocol *pProtocol, Variant &request); 47 void ProcessInfoPlayback(BaseVariantProtocol *pProtocol, Variant &request); 46 48 }; 47 49 -
trunk/sources/applications/applestreamingclient/src/clientcontext.cpp
r56 r74 151 151 } 152 152 153 vector<double> ClientContext::GetAvailableBandwidths() { 154 vector<double> result; 155 156 FOR_MAP(_childPlaylists, uint32_t, Playlist *, i) { 157 ADD_VECTOR_END(result, MAP_KEY(i)); 158 } 159 return result; 160 } 161 162 double ClientContext::GetDetectedBandwidth() { 163 return (uint32_t) _pSpeedComputer->GetMeanSpeed()*8.0; 164 } 165 166 double ClientContext::GetSelectedBandwidth() { 167 return _optimalBw; 168 } 169 170 uint32_t ClientContext::GetBufferLevel() { 171 return GETAVAILABLEBYTESCOUNT(_avData); 172 } 173 174 uint32_t ClientContext::GetMaxBufferLevel() { 175 return _maxAVBufferSize; 176 } 177 178 double ClientContext::GetBufferLevelPercent() { 179 return ((double) GetBufferLevel() / (double) GetMaxBufferLevel())*100.00; 180 } 181 153 182 bool ClientContext::StartProcessing() { 154 183 //1. Parse the connecting string and split it into usable pieces … … 255 284 256 285 //4. Get the inbound TS stream 286 if (_pStreamsManager == NULL) { 287 WARN("No stream manager yet"); 288 return true; 289 } 257 290 InNetTSStream *pStream = (InNetTSStream *) _pStreamsManager->FindByUniqueId( 258 291 _streamId); … … 425 458 } 426 459 427 static int aaa = 0;428 429 460 bool ClientContext::SignalSpeedDetected(double instantAmount, double instantTime) { 430 461 // FINEST("instantAmount: %.2f; instantTime: %.8f; Speed: %.2f KB/s", … … 435 466 uint32_t before = _optimalBw; 436 467 meanSpeed *= 8.0; 437 if (((aaa++) % 200) == 0) {438 double ms = meanSpeed / 1024.00 / 8;439 string um = "KB/s";440 if (ms > 1024) {441 ms = ms / 1024.00;442 um = "MB/s";443 }444 //FINEST("Speed: %.2f %s", ms, STR(um));445 }468 // if (((aaa++) % 200) == 0) { 469 // double ms = meanSpeed / 1024.00 / 8; 470 // string um = "KB/s"; 471 // if (ms > 1024) { 472 // ms = ms / 1024.00; 473 // um = "MB/s"; 474 // } 475 // //FINEST("Speed: %.2f %s", ms, STR(um)); 476 // } 446 477 447 478 _optimalBw = MAP_KEY(_childPlaylists.begin()); -
trunk/sources/applications/applestreamingclient/src/protocols/variant/variantappprotocolhandler.cpp
r56 r74 25 25 #include "eventsink/varianteventsink.h" 26 26 #include "applestreamingclientapplication.h" 27 28 #define GET_CONTEXT(pProtocol, request) \ 29 uint32_t contextId = ASC_REQ_CONTEXT_ID(request); \ 30 if (contextId == 0) {\ 31 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); \ 32 return; \ 33 } \ 34 ClientContext *pContext = GetContext(contextId, pProtocol->GetType()); \ 35 if (pContext == NULL) { \ 36 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); \ 37 return; \ 38 } 27 39 28 40 VariantAppProtocolHandler::VariantAppProtocolHandler(Variant &configuration) … … 66 78 } else if (type == ASC_REQ_TYPE_INFO_LIST_ALL_STREAMS) { 67 79 ProcessInfoListAllStreams(pProtocol, lastReceived); 80 } else if (type == ASC_REQ_TYPE_INFO_BANDWIDTH) { 81 ProcessInfoBandwidth(pProtocol, lastReceived); 82 } else if (type == ASC_REQ_TYPE_INFO_PLAYBACK) { 83 ProcessInfoPlayback(pProtocol, lastReceived); 68 84 } else { 69 85 WARN("Processing type `%s` not yet implemented", STR(type)); … … 92 108 void VariantAppProtocolHandler::ProcessContextClose(BaseVariantProtocol *pProtocol, 93 109 Variant &request) { 94 uint32_t contextId = ASC_REQ_CONTEXT_ID(request); 95 if (contextId == 0) { 96 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); 97 return; 98 } 99 ClientContext *pContext = GetContext(contextId, pProtocol->GetType()); 100 if (pContext == NULL) { 101 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); 102 return; 103 } 110 GET_CONTEXT(pProtocol, request); 104 111 ClientContext::ReleaseContext(contextId); 105 112 ASC_RES_BUILD_OK(request, Variant()); … … 114 121 void VariantAppProtocolHandler::ProcessCommandPlay( 115 122 BaseVariantProtocol *pProtocol, Variant &request) { 116 uint32_t contextId = ASC_REQ_CONTEXT_ID(request); 117 if (contextId == 0) { 118 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); 119 return; 120 } 121 ClientContext *pContext = GetContext(contextId, pProtocol->GetType()); 122 if (pContext == NULL) { 123 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); 124 return; 125 } 126 123 GET_CONTEXT(pProtocol, request); 127 124 string connectingString = ASC_REQ_COMMAND_PLAY_URI(request); 128 125 if (ASC_REQ_COMMAND_PLAY_PASSWORD(request) != "") { … … 152 149 void VariantAppProtocolHandler::ProcessInfoListStreams( 153 150 BaseVariantProtocol *pProtocol, Variant &request) { 154 uint32_t contextId = ASC_REQ_CONTEXT_ID(request); 155 if (contextId == 0) { 156 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); 157 return; 158 } 159 ClientContext *pContext = GetContext(contextId, pProtocol->GetType()); 160 if (pContext == NULL) { 161 ASC_RES_BUILD_CONTEXT_NOT_FOUND(request); 162 return; 163 } 151 GET_CONTEXT(pProtocol, request); 164 152 if (pContext->EventSink()->GetType() == EVENT_SYNC_VARIANT) { 165 153 VariantEventSink *pSink = (VariantEventSink *) pContext->EventSink(); … … 196 184 ASC_RES_BUILD_OK_INFO_LIST_ALL_STREAMS(request, allStreams); 197 185 } 186 187 void VariantAppProtocolHandler::ProcessInfoBandwidth( 188 BaseVariantProtocol *pProtocol, Variant &request) { 189 GET_CONTEXT(pProtocol, request); 190 ASC_RES_BUILD_OK_INFO_BANDWIDTH(request, 191 pContext->GetAvailableBandwidths(), 192 pContext->GetDetectedBandwidth(), 193 pContext->GetSelectedBandwidth(), 194 pContext->GetBufferLevel(), 195 pContext->GetMaxBufferLevel(), 196 pContext->GetBufferLevelPercent()); 197 } 198 199 void VariantAppProtocolHandler::ProcessInfoPlayback( 200 BaseVariantProtocol *pProtocol, Variant &request) { 201 GET_CONTEXT(pProtocol, request); 202 /* 203 * seek range 204 * current position 205 */ 206 // ASC_RES_BUILD_OK_INFO_PLAYBACK(request, 207 // pContext->GetMinTimestamp(), 208 // pContext->GetMaxTimestamp(), 209 // pContext->GetChunksCount(), 210 // pContext->GetCurrentTimestamp(), 211 // pContext->GetCurrentChunkIndex()); 212 ASC_RES_BUILD_NYI(request); 213 }
Note: See TracChangeset
for help on using the changeset viewer.
