Implementing a small memory bug fix with regards to AV_FREE_FRAME and audio_frame. Also adding in support for duration to be set by JSON, to support long videos from openshot-qt.

This commit is contained in:
Jonathan Thomas
2016-08-15 00:44:51 -05:00
parent 98ccfb5ee1
commit 28cc591faf
2 changed files with 14 additions and 3 deletions

View File

@@ -1050,7 +1050,6 @@ void FFmpegReader::ProcessAudioPacket(long int requested_frame, long int target_
avr = NULL;
// Free AVFrames
AV_FREE_FRAME(&audio_frame);
av_free(audio_converted->data[0]);
AV_FREE_FRAME(&audio_converted);
@@ -1183,6 +1182,9 @@ void FFmpegReader::ProcessAudioPacket(long int requested_frame, long int target_
// TODO: Fix this bug. Wait on the task to complete. This is not ideal, but solves an issue with the
// audio_frame being modified by the next call to this method. I think this is a scope issue with OpenMP.
#pragma omp taskwait
// Free audio frame
AV_FREE_FRAME(&audio_frame);
}

View File

@@ -941,6 +941,12 @@ void Timeline::SetJsonValue(Json::Value root) throw(InvalidFile, ReaderClosed) {
AddEffect(e);
}
}
if (!root["duration"].isNull()) {
// Update duration of timeline
info.duration = root["duration"].asDouble();
info.video_length = info.fps.ToFloat() * info.duration;
}
}
// Apply a special formatted JSON object, which represents a change to the timeline (insert, update, delete)
@@ -1208,8 +1214,11 @@ void Timeline::apply_json_to_timeline(Json::Value change) throw(InvalidJSONKey)
else if (root_key == "viewport_y")
// Set viewport y offset
viewport_y.SetJsonValue(change["value"]);
else if (root_key == "duration") { }
// Ignore for now
else if (root_key == "duration") {
// Update duration of timeline
info.duration = change["value"].asDouble();
info.video_length = info.fps.ToFloat() * info.duration;
}
else if (root_key == "width")
// Set width
info.width = change["value"].asInt();