Skip to content

Frame size of MPEG Audio not utilized for finding next frame header #76

Description

@Slamy

Hello, I hope you are alright. It seems you have been absent for quite a while.

I've noticed an issue when playing the MPEG stream from sonde.rtf from the CD-i title Chaos Control (Germany).
The issue is caused by having a 0xff just before a frame header.

I already know the solution but since my fork of pl_mpeg has diverged quite a lot, I can only make suggestions.

Within your implementation of plm_audio_decode_header you didn't seem to be so happy about the synchronization.
One issue I can see here is that next_frame_data_size is never used to calculate the next position.

	assert(( self->buffer->bit_index & 7)==0);
	int expected_bit_index_after_frame = self->buffer->bit_index + (self->next_frame_data_size<<3);
	plm_audio_decode_frame(self);
	assert(( self->buffer->bit_index & 7)==0);

	if (self->buffer->bit_index < expected_bit_index_after_frame)
	{
		printf("skip from %d for %d\n",self->buffer->bit_index>>3,expected_bit_index_after_frame - self->buffer->bit_index);
		plm_buffer_skip(self->buffer,expected_bit_index_after_frame - self->buffer->bit_index);
	}

This has fixed it for me, but it might be possible that only works because I use pl_mpeg behind with a giant buffer of virtual memory.
And I only use the elementary stream parts of pl_mpeg.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions