Opened 13 years ago

Closed 13 years ago

#3416 closed defect (fixed)

mpegts adding av streams with bad codecs

Reported by: anonymous Owned by: danielk
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In the process of coding up support for Brighthouse Tampa's PACE550 cablebox via FireWire?, my final challenge came in the form of MythTV thinking that the AC3 audio stream was actually MPEG1 Video. I tracked the problem down to r6861 (2005-06-18 ljr) where code was added to libavformat/mpegts.c handle_packet().

    if (ts->auto_guess && tss == NULL && is_start) {
        PESContext *pes = add_pes_stream(ts, pid, 0);
        if (pes)
            new_pes_av_stream(pes, 0);

        tss = ts->pids[pid];
    }

This adds a pes stream stream to the transport stream context then adds a "blank" (for lack of a better term) av stream as the handler for that pes. Since both stream type and stream code are hardcoded to 0, codec_type is set to CODEC_TYPE_VIDEO and codec_id is set to CODEC_ID_MPEG1VIDEO. That's fine except...

When mpegts_push_data is later called to parse the actual data in the TS packets, the actual stream code is parsed correctly (0xe0 for the video ES, and th 0xbd for the audio ES). However, since the av stream (pes->st) is already allocated

                    if (!pes->st && 0 == new_pes_av_stream(pes, code)) {

Is is never updated with the appropriate codec type and ID.

Long story short the video plays but the audio stream is still MPEG1VIDEO so I have no audio. Removing the new_pes_av_stream() call from the first code block allows the code in mpegts_push_data to allocate it and set the values correctly.

Sample recording is here (original filename 2690_20070505092733.mpg, 30MB): http://home.capnbry.net:22674/firewireac3test.mpg

Attachments (1)

remove_new_pes_av.diff (534 bytes) - added by bmayland@… 13 years ago.
patch to remove av stream allocator

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by bmayland@…

Attachment: remove_new_pes_av.diff added

patch to remove av stream allocator

comment:1 Changed 13 years ago by danielk

Owner: changed from Isaac Richards to danielk

comment:2 Changed 13 years ago by danielk

Resolution: fixed
Status: newclosed

(In [14443]) Fixes #3416. Applies patch from bmayland leoninedev com, which fixes a stray stream problem. This brings us into sync in this code with ffmpeg and appears not to cause any problems.

Note: See TracTickets for help on using tickets.