Fixed a bug in time stretch (#1818)

diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
index 8078b0f..2113781 100644
--- a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
+++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
@@ -553,17 +553,11 @@
         mask.getMaskAnimations().get(i).setProgress(progress);
       }
     }
-    if (layerModel.getTimeStretch() != 0) {
-      progress /= layerModel.getTimeStretch();
-    }
     if (inOutAnimation != null) {
-      // Time stretch needs to be divided again for the inOutAnimation.
-      inOutAnimation.setProgress(progress / layerModel.getTimeStretch());
+      inOutAnimation.setProgress(progress);
     }
     if (matteLayer != null) {
-      // The matte layer's time stretch is pre-calculated.
-      float matteTimeStretch = matteLayer.layerModel.getTimeStretch();
-      matteLayer.setProgress(progress * matteTimeStretch);
+      matteLayer.setProgress(progress);
     }
     for (int i = 0; i < animations.size(); i++) {
       animations.get(i).setProgress(progress);
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java
index 11632bd..4779ff1 100644
--- a/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java
+++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java
@@ -147,7 +147,8 @@
     if (timeRemapping == null) {
       progress -= layerModel.getStartProgress();
     }
-    if (layerModel.getTimeStretch() != 0) {
+    //Time stretch needs to be divided if is not "__container"
+    if (layerModel.getTimeStretch() != 0 && !"__container".equals(layerModel.getName())) {
       progress /= layerModel.getTimeStretch();
     }
     for (int i = layers.size() - 1; i >= 0; i--) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
index 47c359d..e7cd454 100644
--- a/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
+++ b/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
@@ -248,12 +248,6 @@
     }
     reader.endObject();
 
-    // Bodymovin pre-scales the in frame and out frame by the time stretch. However, that will
-    // cause the stretch to be double counted since the in out animation gets treated the same
-    // as all other animations and will have stretch applied to it again.
-    inFrame /= timeStretch;
-    outFrame /= timeStretch;
-
     List<Keyframe<Float>> inOutKeyframes = new ArrayList<>();
     // Before the in frame
     if (inFrame > 0) {
diff --git a/sample/src/main/assets/Tests/TimeStretchPrecomp2.json b/sample/src/main/assets/Tests/TimeStretchPrecomp2.json
new file mode 100644
index 0000000..a000bbe
--- /dev/null
+++ b/sample/src/main/assets/Tests/TimeStretchPrecomp2.json
@@ -0,0 +1,497 @@
+{
+    "v": "5.7.3",
+    "fr": 25,
+    "ip": 0,
+    "op": 200,
+    "w": 720,
+    "h": 720,
+    "nm": "2222",
+    "ddd": 0,
+    "assets": [
+        {
+            "id": "comp_0",
+            "layers": [
+                {
+                    "ddd": 0,
+                    "ind": 1,
+                    "ty": 4,
+                    "nm": "形状图层 14",
+                    "sr": 2,
+                    "ks": {
+                        "o": {
+                            "a": 0,
+                            "k": 100,
+                            "ix": 11
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0,
+                            "ix": 10
+                        },
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                604.375,
+                                402,
+                                0
+                            ],
+                            "ix": 2
+                        },
+                        "a": {
+                            "a": 0,
+                            "k": [
+                                -372,
+                                42,
+                                0
+                            ],
+                            "ix": 1
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                101.874,
+                                100,
+                                100
+                            ],
+                            "ix": 6
+                        }
+                    },
+                    "ao": 0,
+                    "shapes": [
+                        {
+                            "ty": "gr",
+                            "it": [
+                                {
+                                    "ind": 0,
+                                    "ty": "sh",
+                                    "ix": 1,
+                                    "ks": {
+                                        "a": 1,
+                                        "k": [
+                                            {
+                                                "i": {
+                                                    "x": 0.667,
+                                                    "y": 1
+                                                },
+                                                "o": {
+                                                    "x": 0.333,
+                                                    "y": 0
+                                                },
+                                                "t": 0,
+                                                "s": [
+                                                    {
+                                                        "i": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "o": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "v": [
+                                                            [
+                                                                -51.35,
+                                                                -640
+                                                            ],
+                                                            [
+                                                                -51.35,
+                                                                640
+                                                            ],
+                                                            [
+                                                                -51.4,
+                                                                640
+                                                            ],
+                                                            [
+                                                                -51.4,
+                                                                -640
+                                                            ]
+                                                        ],
+                                                        "c": true
+                                                    }
+                                                ]
+                                            },
+                                            {
+                                                "i": {
+                                                    "x": 0.667,
+                                                    "y": 1
+                                                },
+                                                "o": {
+                                                    "x": 0.333,
+                                                    "y": 0
+                                                },
+                                                "t": 34,
+                                                "s": [
+                                                    {
+                                                        "i": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "o": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "v": [
+                                                            [
+                                                                51.4,
+                                                                -640
+                                                            ],
+                                                            [
+                                                                51.4,
+                                                                640
+                                                            ],
+                                                            [
+                                                                -51.4,
+                                                                640
+                                                            ],
+                                                            [
+                                                                -51.4,
+                                                                -640
+                                                            ]
+                                                        ],
+                                                        "c": true
+                                                    }
+                                                ]
+                                            },
+                                            {
+                                                "i": {
+                                                    "x": 0.833,
+                                                    "y": 1
+                                                },
+                                                "o": {
+                                                    "x": 0.333,
+                                                    "y": 0
+                                                },
+                                                "t": 62,
+                                                "s": [
+                                                    {
+                                                        "i": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "o": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "v": [
+                                                            [
+                                                                51.4,
+                                                                -640
+                                                            ],
+                                                            [
+                                                                51.4,
+                                                                640
+                                                            ],
+                                                            [
+                                                                -51.4,
+                                                                640
+                                                            ],
+                                                            [
+                                                                -51.4,
+                                                                -640
+                                                            ]
+                                                        ],
+                                                        "c": true
+                                                    }
+                                                ]
+                                            },
+                                            {
+                                                "t": 100,
+                                                "s": [
+                                                    {
+                                                        "i": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "o": [
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ],
+                                                            [
+                                                                0,
+                                                                0
+                                                            ]
+                                                        ],
+                                                        "v": [
+                                                            [
+                                                                51.4,
+                                                                -640
+                                                            ],
+                                                            [
+                                                                51.4,
+                                                                640
+                                                            ],
+                                                            [
+                                                                51.1,
+                                                                640
+                                                            ],
+                                                            [
+                                                                51.1,
+                                                                -640
+                                                            ]
+                                                        ],
+                                                        "c": true
+                                                    }
+                                                ]
+                                            }
+                                        ],
+                                        "ix": 2
+                                    },
+                                    "nm": "路径 1",
+                                    "mn": "ADBE Vector Shape - Group",
+                                    "hd": false
+                                },
+                                {
+                                    "ty": "fl",
+                                    "c": {
+                                        "a": 0,
+                                        "k": [
+                                            0.96862745285,
+                                            0.960784316063,
+                                            0.172549024224,
+                                            1
+                                        ],
+                                        "ix": 4
+                                    },
+                                    "o": {
+                                        "a": 0,
+                                        "k": 100,
+                                        "ix": 5
+                                    },
+                                    "r": 1,
+                                    "bm": 0,
+                                    "nm": "EditableColor#2",
+                                    "mn": "ADBE Vector Graphic - Fill",
+                                    "hd": false,
+                                    "ln": "2"
+                                },
+                                {
+                                    "ty": "tr",
+                                    "p": {
+                                        "a": 0,
+                                        "k": [
+                                            -310,
+                                            42
+                                        ],
+                                        "ix": 2
+                                    },
+                                    "a": {
+                                        "a": 0,
+                                        "k": [
+                                            0,
+                                            0
+                                        ],
+                                        "ix": 1
+                                    },
+                                    "s": {
+                                        "a": 0,
+                                        "k": [
+                                            100,
+                                            100
+                                        ],
+                                        "ix": 3
+                                    },
+                                    "r": {
+                                        "a": 0,
+                                        "k": 0,
+                                        "ix": 6
+                                    },
+                                    "o": {
+                                        "a": 0,
+                                        "k": 100,
+                                        "ix": 7
+                                    },
+                                    "sk": {
+                                        "a": 0,
+                                        "k": 0,
+                                        "ix": 4
+                                    },
+                                    "sa": {
+                                        "a": 0,
+                                        "k": 0,
+                                        "ix": 5
+                                    },
+                                    "nm": "变换"
+                                }
+                            ],
+                            "nm": "矩形 1",
+                            "np": 2,
+                            "cix": 2,
+                            "bm": 0,
+                            "ix": 1,
+                            "mn": "ADBE Vector Group",
+                            "hd": false
+                        }
+                    ],
+                    "ip": 0,
+                    "op": 100,
+                    "st": 0,
+                    "bm": 0
+                }
+            ]
+        }
+    ],
+    "layers": [
+        {
+            "ddd": 0,
+            "ind": 1,
+            "ty": 0,
+            "nm": "测试2",
+            "refId": "comp_0",
+            "sr": 2,
+            "ks": {
+                "o": {
+                    "a": 0,
+                    "k": 100,
+                    "ix": 11
+                },
+                "r": {
+                    "a": 0,
+                    "k": 0,
+                    "ix": 10
+                },
+                "p": {
+                    "a": 0,
+                    "k": [
+                        360,
+                        360,
+                        0
+                    ],
+                    "ix": 2
+                },
+                "a": {
+                    "a": 0,
+                    "k": [
+                        360,
+                        360,
+                        0
+                    ],
+                    "ix": 1
+                },
+                "s": {
+                    "a": 0,
+                    "k": [
+                        100,
+                        100,
+                        100
+                    ],
+                    "ix": 6
+                }
+            },
+            "ao": 0,
+            "w": 720,
+            "h": 720,
+            "ip": 0,
+            "op": 200,
+            "st": 0,
+            "bm": 0
+        }
+    ],
+    "markers": []
+}
\ No newline at end of file