Skip to content

RationalTime value mismatch when serialize/deserialize to JSON #1822

Open
@rdelillo

Description

@rdelillo

Required:


  • I believe this isn't a duplicate topic
  • This report is not related to an adapter

For adapter related issues, please go to the appropriate repository - likely in
the OpenTimelineIO github organization.
For general questions and help please use the
Academy Software Foundation slack,
#opentimelineio.

Select One:

  • Build problem
  • Incorrect Functionality or bug
  • New feature or functionality

Description

I'm having RationalTime accuracy issue when serializing/deserializing a Clip as json.
It's very small but enough to produce value comparison mismatch on my end.

Is that expected ? Has anyone spotted that before ?
Is there something else I do not understand ?

(tested with opentimelineio-0.17.0 )

Reproduction Steps

import opentimelineio as otio

rate_23_976 = 23.976024627685547

# Create a random clip
start =  otio.opentime.RationalTime(30, 24.0)
src_range = otio.opentime.TimeRange(
  start.rescaled_to(rate_23_976),
  otio.opentime.RationalTime(0, rate_23_976)
)
clip = otio.schema.Clip(name="test", source_range=src_range)

# Recreate same clip through serialization/deserialization to JSON
clip2 = otio.schema.Clip.from_json_string(clip.to_json_string())

# Comparison
assert clip2.source_range.start_time == clip.source_range.start_time  # I'm expecting this to be True but raises
assert clip.source_range.start_time.rate == clip2.source_range.start_time.rate  # OK
assert clip.source_range.start_time.value == clip2.source_range.start_time.value # raises

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem, flaw, or broken functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions