Repository navigation
cellDmuxPamf - #18218
cellDmuxPamf#18218
Conversation
| case state::initial: | ||
| { | ||
| // Search for the next pack start code or prog end code | ||
| std::span<const u8, PACK_SIZE> pack{ static_cast<const u8*>(nullptr), PACK_SIZE }; // This initial value is not used, can't be default constructed |
There was a problem hiding this comment.
This is a UB, you will have to use another solution. (span range must be valid)
You can refer an uninitialized buffer from the stack for example.
There was a problem hiding this comment.
I actually had to fix a bit more here, streams can be smaller than 0x800 bytes. In dmux_pamf_base::set_stream, I used to assert that streams are a multiple of 0x800 bytes in size (PACK_SIZE), that's why I gave the span static extend
| if (pts_dts_flag < 0) | ||
| { | ||
| // The timestamps should be unsigned, but are sign-extended from s32 to u64 on LLE. They probably forgot about integer promotion | ||
| const s32 PTS_32_30 = read_from_ptr<u8>(current_pes_packet.begin() + 9) >> 1; |
There was a problem hiding this comment.
read_from_ptr allow indexing using the second argument
| { | ||
| // The timestamps should be unsigned, but are sign-extended from s32 to u64 on LLE. They probably forgot about integer promotion | ||
| const s32 PTS_32_30 = read_from_ptr<u8>(current_pes_packet.begin() + 9) >> 1; | ||
| const s32 PTS_29_15 = read_from_ptr<be_t<u16>>(current_pes_packet.begin() + 10) >> 1; |
There was a problem hiding this comment.
At this point maybe you can use something like:
bf_t<be_t<u32>, 1, 15> so the shift can be more explicit also for the others.
|
|
||
| if (sys_mutex_lock(ppu, mutex, 0) != CELL_OK) | ||
| { | ||
| SEND_FATAL_ERR_AND_CONTINUE(); |
There was a problem hiding this comment.
The use of macros here is a bit excessive, you can raise a flag that you can check at the start of the loop, then use continue; so it would jump back to check it. (I approve the use of the second macro RETURN_ON_CPU_FLAG_AGAIN though)
df0afad to
7557f14
Compare
In addition to the previous commits:
DmuxPamfContext::close