summaryrefslogtreecommitdiff
path: root/rotord/rendercontext.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@herge.(none)>2013-05-03 18:25:26 +0100
committerTim Redfern <tim@herge.(none)>2013-05-03 18:25:26 +0100
commitff59340614ec150e4bd84d3554081e666970aef2 (patch)
treeb32689f18b0457580ecf1c7934edd69142a9e005 /rotord/rendercontext.cpp
parent4aa8f7c20c5e8bbe1ed9b007a1193ced8b019f4d (diff)
elusive hang while rendering
Diffstat (limited to 'rotord/rendercontext.cpp')
-rw-r--r--rotord/rendercontext.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/rotord/rendercontext.cpp b/rotord/rendercontext.cpp
index d6469bd..d0fa5bd 100644
--- a/rotord/rendercontext.cpp
+++ b/rotord/rendercontext.cpp
@@ -19,17 +19,19 @@ void Render_context::runTask() {
processors.push_back(dynamic_cast<Base_audio_processor*>(a));
}
if (load_audio(audio_filename,processors)) {
- state=AUDIO_READY;
+ audio_loaded=true;
+ state=IDLE;
}
else {
//an error occurred: TODO have to clean up allocated data. autoptr?
+ audio_loaded=false;
state=IDLE;
}
}
if(cmd==RENDER) {
state=RENDERING;
- if(graph.video_render(output_filename,audio_filename,output_framerate)){
- state=RENDER_READY;
+ if(graph.video_render(output_filename,audio_filename,output_framerate,progress)){
+ state=IDLE;
}
else {
//an error occurred: TODO have to clean up allocated data. autoptr?
@@ -88,7 +90,7 @@ Command_response Render_context::session_command(const std::vector<std::string>&
sprintf(c,"%02f",progress);
response.description+="<progress>"+string(c)+"</progress>\n";
}
- if (state==AUDIO_READY) {
+ else if (audio_loaded) {
//not sure about this-- should this state be retained?
//can the data only be read once?
//for now
@@ -97,7 +99,10 @@ Command_response Render_context::session_command(const std::vector<std::string>&
response.description+="<audio>\n";
response.description+=audio_thumb->print();
response.description+="</audio>";
- state=IDLE;
+ }
+ else {
+ response.status=HTTPResponse::HTTP_BAD_REQUEST;
+ response.description="<status context='"+command[1]+"'>Rotor: no audio loaded</status>\n";
}
}
if (command[0]=="DELETE") {
@@ -230,8 +235,8 @@ Command_response Render_context::session_command(const std::vector<std::string>&
if (command[0]=="GET") {
//DUMMY RESPONSE
response.status=HTTPResponse::HTTP_OK;
- response.description="<status context='"+command[1]+"'>DUMMY RESPONSE Rotor: rendering video</status>\n";
- response.description+="<progress>25.2</progress>\n";
+ response.description="<status context='"+command[1]+"'>Rotor: rendering video</status>\n";
+ response.description+="<progress>"+ofToString(progress)+"</progress>\n";
}
if (command[0]=="PUT") {
if (command.size()>2) {
@@ -383,9 +388,9 @@ bool Render_context::load_audio(const string &filename,vector<Base_audio_process
p->process_frame(frame->data[0],frame->nb_samples);
}
sample_processed+=frame->nb_samples;
- mutex.lock();
- progress=((double)sample_processed)/samples;
- mutex.unlock();
+ //mutex.lock();
+ progress=((float)sample_processed)/samples;
+ //mutex.unlock();
}
}
// You *must* call av_free_packet() after each call to av_read_frame() or else you'll leak memory