Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Issue 2808833005: Seek for video track changes on FFmpegDemuxer.

Created:
3 years, 8 months ago by DaleCurtis
Modified:
3 years, 7 months ago
Reviewers:
CC:
apacible+watch_chromium.org, chromium-reviews, erickung+watch_chromium.org, feature-media-reviews_chromium.org, miu+watch_chromium.org, posciak+watch_chromium.org, xjz+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Seek for video track changes on FFmpegDemuxer. Prototype fix for seeking when doing a track change on src=. Mostly works, but does not resolve the following edges: - If there's a gap between last read audio frame and seeked video point, we'll lose audio - fix is likely to use same logic as Seek() instead of using |selected_stream| for the seek index. - Needs a better mechanism for ignoring already demuxed packets so that we don't get repetitions in the audio. There are "valid" files with out of order timestamps, so care must be taken not to break those. - Does not handle errors which occur during seeking. * NOT READY FOR SUBMISSION * BUG=709302 TEST=basic fg/bg with bg opt works correctly.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -1 line) Patch
M media/blink/webmediaplayer_impl.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M media/filters/ffmpeg_demuxer.cc View 2 chunks +21 lines, -1 line 0 comments Download

Messages

Total messages: 5 (1 generated)
DaleCurtis
3 years, 8 months ago (2017-04-11 00:49:24 UTC) #2
servolk
On 2017/04/11 00:49:24, DaleCurtis wrote: Dale, thanks for putting together this CL! I have tested ...
3 years, 7 months ago (2017-04-29 00:04:08 UTC) #3
servolk
On 2017/04/29 00:04:08, servolk wrote: > On 2017/04/11 00:49:24, DaleCurtis wrote: > > Dale, thanks ...
3 years, 7 months ago (2017-04-29 00:12:02 UTC) #4
DaleCurtis
3 years, 7 months ago (2017-05-01 22:57:48 UTC) #5
On 2017/04/29 at 00:04:08, servolk wrote:
> On 2017/04/11 00:49:24, DaleCurtis wrote:
> 
> Dale, thanks for putting together this CL! I have tested it and indeed the
video resumes much faster with it, since we resume playback as soon as video
decoder catches up with the current playback position, instead of having to wait
for the next key frame.
> But I have a few follow up questions re the points you made in the CL
description:
> 
> > If there's a gap between last read audio frame and seeked video point, we'll
lose audio - fix is likely to use same logic as Seek() instead of using
|selected_stream| for the seek index.
> 
> I believe it's highly unlikely in properly muxed streams, since the seek
should go backward - to the nearest video key frame before the current playback
position. I guess it's possible that in badly muxed streams this might move the
stream read pointer forward and cause a gap in audio, but it's not clear to me
how we could mitigate that. I believe that even if we do a full-fledged
FFmpegDemuxer::Seek with video as preferred stream, we still have the same risk
for badly-muxed streams, or did I misunderstand something here?

Unlikely won't cut it in this case, it is possible, so we need to make sure we
don't break these playbacks. If we use the full fledged seek ffmpeg will take
care of ensuring other streams are at the right place.

> 
> > Needs a better mechanism for ignoring already demuxed packets so that we
don't get repetitions in the audio. There are "valid" files with out of order
timestamps, so care must be taken not to break those.
> 
> I don't have a lot of context on this - could you give an example of a stream
that would have an out-of-order timestamps? Are timestamps out of order only
when we initially receive them from ffmpeg or are they out-of-order even after
all the timestamp fixups and adjustments done in
FFmpegDemuxerStream::EnqueuePacket? Can audio buffers with out-of-order
timestamps reach the audio renderer? (i.e. does the audio renderer know how to
handle those cases, or do we handle that somewhere earlier in the media
pipeline?).

chained ogg files will have out of order timestamps; b-frame based video will
have out of order timestamps at the demuxer level.

> 
> > Does not handle errors which occur during seeking.
> 
> Agree, but looking at
https://cs.chromium.org/chromium/src/media/filters/ffmpeg_demuxer.cc?rcl=dbec...
it seems to me that we don't handle errors well even during regular seeking :) I
think we should do at least something like this:
> MEDIA_LOG << " seek failed: " << AVErrorToString(result);
> I'll send a CL.

Thanks will take a look.

Powered by Google App Engine
This is Rietveld 408576698