mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-20 22:20:56 +00:00
Added Stetho for easy Android debugging. Updated videocache aar. Added a
check to ensure range header is well formed (to > from).
This commit is contained in:
parent
b2906e94c7
commit
09fb5f1f4b
src
musikdroid/app
plugins/websocket_remote
@ -52,6 +52,7 @@ dependencies {
|
||||
compile 'com.google.android.exoplayer:exoplayer:r2.4.1'
|
||||
compile 'com.google.android.exoplayer:extension-okhttp:r2.4.1'
|
||||
compile 'com.github.pluscubed:recycler-fast-scroll:0.3.2@aar'
|
||||
compile 'com.facebook.stetho:stetho:1.5.0'
|
||||
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.android.support:recyclerview-v7:25.3.1'
|
||||
|
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
package io.casey.musikcube.remote;
|
||||
|
||||
import com.facebook.stetho.Stetho;
|
||||
|
||||
import io.casey.musikcube.remote.playback.StreamProxy;
|
||||
import io.casey.musikcube.remote.util.NetworkUtil;
|
||||
|
||||
@ -9,7 +11,13 @@ public class Application extends android.app.Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
instance = this;
|
||||
|
||||
super.onCreate();
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
Stetho.initializeWithDefaults(this);
|
||||
}
|
||||
|
||||
NetworkUtil.init();
|
||||
StreamProxy.init(this);
|
||||
}
|
||||
|
@ -132,6 +132,10 @@ static ssize_t fileReadCallback(void *cls, uint64_t pos, char *buf, size_t max)
|
||||
static void fileFreeCallback(void *cls) {
|
||||
Range* range = static_cast<Range*>(cls);
|
||||
if (range->file) {
|
||||
#ifdef ENABLE_DEBUG
|
||||
std::cerr << "******** REQUEST CLOSE: " << range->file << " ********\n\n";
|
||||
#endif
|
||||
|
||||
range->file->Destroy();
|
||||
range->file = nullptr;
|
||||
}
|
||||
@ -146,7 +150,7 @@ static Range* parseRange(IDataStream* file, const char* range) {
|
||||
result->file = file;
|
||||
result->total = size;
|
||||
result->from = 0;
|
||||
result->to = (size == 0) ? 0 : size - 1;
|
||||
result->to = (size <= 0) ? 0 : size - 1;
|
||||
|
||||
if (range) {
|
||||
std::string str(range);
|
||||
@ -166,8 +170,10 @@ static Range* parseRange(IDataStream* file, const char* range) {
|
||||
to = std::stoul(boost::algorithm::trim_copy(parts[1]));
|
||||
}
|
||||
|
||||
result->from = from;
|
||||
result->to = (to == 0) ? 0 : to - 1;
|
||||
if (to > from) {
|
||||
result->from = from;
|
||||
result->to = (to == 0) ? 0 : to - 1;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
/* return false below */
|
||||
@ -372,7 +378,7 @@ int HttpServer::HandleRequest(
|
||||
Range* range = parseRange(file, rangeVal);
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
std::cerr << "potential response hader : " << range->HeaderValue() << std::endl;
|
||||
std::cerr << "potential response header : " << range->HeaderValue() << std::endl;
|
||||
#endif
|
||||
|
||||
/* ehh... */
|
||||
@ -380,7 +386,6 @@ int HttpServer::HandleRequest(
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
std::cerr << "on demand? " << isOnDemandTranscoder << std::endl;
|
||||
std::cerr << "file: " << file << std::endl;
|
||||
#endif
|
||||
|
||||
/* gotta be careful with request ranges if we're transcoding. don't
|
||||
@ -439,7 +444,8 @@ int HttpServer::HandleRequest(
|
||||
&fileFreeCallback);
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
std::cerr << "response length: " << length << "\n";
|
||||
std::cerr << "response length: " << ((length == 0) ? 0 : length + 1) << "\n";
|
||||
std::cerr << "id: " << file << "\n";
|
||||
#endif
|
||||
|
||||
if (response) {
|
||||
@ -471,7 +477,7 @@ int HttpServer::HandleRequest(
|
||||
status = MHD_HTTP_PARTIAL_CONTENT;
|
||||
#ifdef ENABLE_DEBUG
|
||||
if (rangeVal) {
|
||||
std::cerr << "selected partial content! " << range->HeaderValue() << "\n";
|
||||
std::cerr << "actual range header: " << range->HeaderValue() << "\n";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -500,7 +506,7 @@ int HttpServer::HandleRequest(
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
std::cerr << "******** REQUEST END ********\n\n";
|
||||
std::cerr << "*******************************\n\n";
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user