summaryrefslogtreecommitdiff
path: root/rotord/src
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src')
-rw-r--r--rotord/src/graph.cpp2
-rw-r--r--rotord/src/graph.h3
-rw-r--r--rotord/src/rendercontext.cpp2
-rw-r--r--rotord/src/rendercontext.h14
-rw-r--r--rotord/src/rotord.cpp2
5 files changed, 17 insertions, 6 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index f904a9d..b70684f 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -211,7 +211,9 @@ bool Graph::video_render(const string &output_filename,const float framerate,int
exporter.encodeFrame(i->RGBdata);
}
vf+=vstep;
+ mutex.lock();
progress=vf/duration;
+ mutex.unlock();
if (usingaudio) {delete a;};
}
diff --git a/rotord/src/graph.h b/rotord/src/graph.h
index a13bddf..b775c5a 100644
--- a/rotord/src/graph.h
+++ b/rotord/src/graph.h
@@ -77,6 +77,9 @@ namespace Rotor {
float progress;
int bitRate;
+ Poco::Mutex mutex; //lock for access from parent thread
+
+
Audio_thumbnailer *audio_thumb;
private:
int outW,outH;
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp
index 1beb6cc..2a9dd62 100644
--- a/rotord/src/rendercontext.cpp
+++ b/rotord/src/rendercontext.cpp
@@ -490,9 +490,11 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.commands[1]=="render") {
if (command.method=="GET") {
if(state==RENDERING){
+ graph.mutex.lock();
status=HTTPResponse::HTTP_OK;
XML.addValue("status","Rendering video");
XML.addValue("progress",toString(graph.progress));
+ graph.mutex.unlock();
}
else {
logger.error("ERROR: Render progress requested but not rendering");
diff --git a/rotord/src/rendercontext.h b/rotord/src/rendercontext.h
index 130c678..0cecf49 100644
--- a/rotord/src/rendercontext.h
+++ b/rotord/src/rendercontext.h
@@ -82,23 +82,25 @@ namespace Rotor {
} //interrupt locking process
Render_status get_render_status(const string &uid){
- //cerr<<"render status requested: "<<uid<<" status: "<<renders[uid].status<<endl;
-
+ graph.mutex.lock();
+ //cerr<<"render status requested: "<<uid<<" status: "<<renders[uid].status<<endl;
+
if (renders.find(uid)!=renders.end()){
if (renders[uid].status==RENDERING){
renders[uid].progress=graph.progress;
}
+ graph.mutex.unlock();
return renders[uid];
}
- else return Render_status(NOT_FOUND);
+ graph.mutex.unlock();
+ return Render_status(NOT_FOUND);
+
};
private:
int state;
//thread only does one thing at once
std::deque<Session_task> work_queue;
std::unordered_map<string,Render_status> renders;
- Poco::Mutex mutex; //lock for access from parent thread
-
std::string output_filename;
std::string graph_dir;
std::string media_dir;
@@ -106,6 +108,8 @@ namespace Rotor {
std::string graph_filename;
std::string graph_body;
+ Poco::Mutex mutex; //lock for access from parent thread
+
Audio_thumbnailer *audio_thumb;
Graph graph;
float output_framerate;
diff --git a/rotord/src/rotord.cpp b/rotord/src/rotord.cpp
index a22c6c3..de853e4 100644
--- a/rotord/src/rotord.cpp
+++ b/rotord/src/rotord.cpp
@@ -29,7 +29,7 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS
theuri.getPathSegments(command);
Logger& logger = Logger::get("Rotor");
- logger.information(request.clientAddress().toString()+" "+request.getMethod());
+ //logger.information(request.clientAddress().toString()+" "+request.getMethod());
HTTPResponse::HTTPStatus status=HTTPResponse::HTTP_BAD_REQUEST; //by default