Project

General

Profile

Actions

Support Request #5857

closed

Wrong duration for empty streams

Added by hidden over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Customer:
VW
Department:
FORSCHUNG
Requester's Priority:
Normal
Support Level:
3rd Level
Resolution:
Product Issue Opened
Platform:
Windows 7 64bit
Topic:
FileLibrary::Reader
FAQ Links:

Description

Hallo ADTF Support Team,

Nach Empfehlung in #5281<https://support.digitalwerk.net/issues/5281#change-24908> versuche ich nun, die ADTF File Library zu nutzen. In der aktuellen Version beta-0.4.0 scheint es aber ein Problem bei der Berechnung der Duration zu geben, wenn die Datei einen leeren Stream enthält.

Datei adtf_file_reader.cpp:

std::chrono::microseconds Reader::getDuration() const
{
    std::vector<Stream> streams = getStreams();
    std::chrono::microseconds first_time = std::chrono::microseconds::max();
    std::chrono::microseconds last_time = std::chrono::microseconds::min();
    for (const auto& current_stream : streams)
    {
        if (current_stream.timestamp_of_first_item < first_time)
        {
            first_time = current_stream.timestamp_of_first_item;
        }
        if (current_stream.timestamp_of_last_item > last_time)
        {
            last_time = current_stream.timestamp_of_last_item;
        }
    }
    return std::chrono::microseconds(last_time - first_time);
}

Ist ein Stream leer, hat dieser in unserer ADTF 2 Datei eine Null für timestamp_of_first_item. Die getDuration Funktion nutzt den deswegen immer für first_time genutzt. Das führt natürlich zu einer falschen Gesamtdauer.

Lösung

CDIFHD-44 erstellt.
Workaround ist im Moment leider nur selber eine getDuration Methode zu Implementieren über getStreams.
Streams bei denen item_count == 0 ist dabei ignorieren.

Actions

Also available in: Atom PDF