Bug 1943217 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I'm not sure if this is intended or a bug, and I discover this issue in this [code](https://searchfox.org/mozilla-central/rev/4f5426084651871759f5346eb0ded2e9ac5326fd/dom/media/platforms/agnostic/bytestreams/H265.cpp#1273-1276).

For the debug purpose, I added following logs.

```
  uint8_t numSPS = config1.unwrap().NumSPS();
  auto numSPS2 = config2.unwrap().NumSPS();
  if (numSPS == 0 || numSPS != numSPS2) {
    return false;
  }

  printf_stderr("DD | ### num1=%u, num2=%u\n", numSPS, numSPS2);
  for (auto idx = 0; idx < 3; idx++) {
    printf_stderr("DD | loop %u, num1=%u, num2=%u\n", idx,
                  config1.unwrap().NumSPS(), config2.unwrap().NumSPS());
  }
```

What I expect is calling `unwrap()` won't affect the successful value in the `Result`. The `NumSPS()` in the first `printf` should be identical with other `printf` in the loop. However, after running above codes, I got the result like below,

```
DD | ### num1=1, num2=1
DD | loop 0, num1=0, num2=0
DD | loop 1, num1=0, num2=0
DD | loop 2, num1=0, num2=0
```

After calling `unwrap()`, it alters the successful value of `HVCCConfig`. Make the following `unwrap()` calls return a incorrect value. I can reproduce this issue by playing [this file](https://searchfox.org/mozilla-central/source/dom/media/test/hevc_white_red_frames.mp4) on Windows.
I'm not sure if this is intended or a bug, and I discover this issue in this [code](https://searchfox.org/mozilla-central/rev/4f5426084651871759f5346eb0ded2e9ac5326fd/dom/media/platforms/agnostic/bytestreams/H265.cpp#1273-1276).

For the debug purpose, I added following logs.

```
  uint8_t numSPS = config1.unwrap().NumSPS();
  auto numSPS2 = config2.unwrap().NumSPS();
  if (numSPS == 0 || numSPS != numSPS2) {
    return false;
  }

  printf_stderr("DD | ### num1=%u, num2=%u\n", numSPS, numSPS2);
  for (auto idx = 0; idx < 3; idx++) {
    printf_stderr("DD | loop %u, num1=%u, num2=%u\n", idx,
                  config1.unwrap().NumSPS(), config2.unwrap().NumSPS());
  }
```

What I expect is calling `unwrap()` won't affect the successful value in the `Result`. The `NumSPS()` in the first `printf` should be identical with other `printf` in the loop. However, after running above codes, I got the result like below,

```
DD | ### num1=1, num2=1
DD | loop 0, num1=0, num2=0
DD | loop 1, num1=0, num2=0
DD | loop 2, num1=0, num2=0
```

After calling `unwrap()`, it alters the successful value of `HVCCConfig`. Make the following `unwrap()` calls return an incorrect value. I can reproduce this issue by playing [this file](https://searchfox.org/mozilla-central/source/dom/media/test/hevc_white_red_frames.mp4) on Windows.

Back to Bug 1943217 Comment 0