Opened 12 years ago

Closed 10 years ago

#4925 closed defect (invalid)

Title: internal dvd player: mytharchive mp2 audio playback issues

Reported by: skamithi Owned by: skamithi
Priority: minor Milestone: unknown
Component: mythtv Version: 0.21-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This issue was identified by John Pilkington and posted in #2797.

if I issue ffmpeg -i on a mytharchive dvd I created about 1 year ago i get

Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x576, 9000 kb/s, 25.00 fps(r)

Stream #0.1[0x80]: Audio: liba52, 48000 Hz, stereo, 448 kb/s Stream #0.2[0x1c0]: Audio: mp2

The 2nd audio stream has no sample rate info. I wonder if this is a ffmpeg bug ?

attached patch does 2 things:

a) change the location AFD::RemoveAudioStreams? is activated. This function cleans up the stream contexts so stale audio stream entries are removed from the list. new location is in AFD::ScanStreams? and is activated only when the DVD encounters the AUDIO_STREAM_CHANGE event.

b)set the sample rate default to 48000hz if sample_rate is 0 but channels are detected. this change is only activated for DVD playback. This 2nd change can be removed if the sample rate issue is a bug and is cleared up at some point.

attached patch resolves the issue. testing it for a couple of weeks to ensure it doesn't break dvd playback for me.

Attachments (3)

mythtv_remove_audio_stream.diff (4.8 KB) - added by skamithi 12 years ago.
remove_audio_streams_v2.diff (5.7 KB) - added by skamithi 12 years ago.
attempt_resolve_crashes_after_removing_streams.diff (1.9 KB) - added by skamithi 12 years ago.

Download all attachments as: .zip

Change History (16)

Changed 12 years ago by skamithi

comment:1 Changed 12 years ago by skamithi

Owner: changed from Isaac Richards to skamithi
Status: newassigned

comment:2 Changed 12 years ago by skamithi

2nd rev of this patch. found out that by reinitializing the audioIn variable in avformatdecoder to the default when audio is disabled, resolves the issue where audio is not enabled when the audio streams change. no need for the hack in the v1 patch where i set the default sample rate to 48000 if a channel is present.

patch adds checks to ffmpeg's utils.c to help avoid a crash during while AFD::RemoveAudioStreams? is active.

Changed 12 years ago by skamithi

comment:3 Changed 12 years ago by skamithi

(In [16659]) Refs #4925, Refs #4862. internal dvd player: add some checks to ffmpeg's utils.c. prevents crashes I found when I applied the rest of patch in #4925. Doesn't cause any problems for me. Want to leave it trunk for testing and if no one finds a problem in 4 weeks will port to 0.21 fixes.

comment:4 Changed 12 years ago by skamithi

(In [16660]) Refs #4925: internal dvd player: activate cleanup of the list of audio streams in the ffmpeg avformatcontext when a dvd AUDIO_CHANGE event occurs. remove previous logic where this was only activated at a title change. will apply to fixes in a couple of weeks if no one reports problems with it.

comment:5 Changed 12 years ago by Paul Kendall <paul@…>

Erik Hovland made another minor patch to the second patch here in ticket #5002, which I think needs to be included.

comment:6 Changed 12 years ago by skamithi

(In [16751]) Refs #4925. internal dvd player. check that audio is enabled before running removal of audio streams. prevents hang at startup of nicholas cage Next DVD.

comment:7 Changed 12 years ago by skamithi

(In [16752]) Refs #4925. internal dvd player forgot to remove this during initial commit for this ticket.

comment:8 Changed 12 years ago by skamithi

(In [16801]) Closes #5002, Refs #4925, Refs #4862. in line 884 of utils.c there still needs to be a check for null of st->codec because it will be dereferenced in the next line in the call to av_parser_init()

comment:9 Changed 12 years ago by skamithi

(In [16802]) Refs #4925. internal dvd player: commit [16659] [16660] [16751] [16752] [16801] from trunk to 0.21-fixes

comment:10 Changed 12 years ago by skamithi

call to av_read_frame_flush in AFD:RemoveAudioStreams is causing dvd still frames not to show up on some dvds. if i remove this call, dvds with a lot of audio changes in the dvd menu crash like crazy on various ffmpeg functions because the codec is still defined by the memory associated with it is deleted. patch attached to the ticket. if anyone has a better way of solving this, please let me know.

Changed 12 years ago by skamithi

comment:11 Changed 12 years ago by skamithi

(In [17304]) Refs #4925 Refs #4862. internal dvd player: remove av_read_frame_flush call when purging audio streams during an audio stream change. commit out some code in utils.c av_remove_stream to help prevent crashes during this process. i hope it doesn't cause issues for anyone else. also noticed latest ffmpeg doesn't have av_remove_stream defined.so whenever a ffmpeg sync is done, i'll have to find a new solution here if the latest ffmpeg doesn't automatically clean out previously used audio streams.

comment:12 Changed 10 years ago by stuartm

Status: assignedinfoneeded

Still an issue with current trunk?

comment:13 Changed 10 years ago by stuartm

Resolution: invalid
Status: infoneededclosed

No feedback from ticket submitter in 30 days

Note: See TracTickets for help on using tickets.