Fix MSE playback regression by not changing pipeline duration at EOS

There has been a regression in MSE stream playback, that I tracked down
to this CL:
https://codereview.chromium.org/740663002/
I think the root cause of the issue is that
Pipeline::RunEndedCallbackIfNeeded invokes SetDuration(media_time) -
this sets media duration on the media::Pipeline object level, but not
on the demuxer level. In case of URL playback that works, since for URL
playback HTMLMediaElement::duration gets the actual duration from the
media::Pipeline (via WebMediaPlayerImpl::duration). But in case of MSE
playback HTMLMediaElement::duration gets duration directly from the
demuxer (via WebMediaSourceImpl::duration) and that causes mismatch
between the HTMLMediaElement::duration and
HTMLMediaElement::currentTime, which causes HTMLMediaElement to never
send the 'ended' event.

I think we shouldn't need to do this SetDuration on the pipeline
level, since WebMediaPlayerImpl::currentTime will return duration()
value after end-of-stream has been processed by media::Pipeline (see
https://code.google.com/p/chromium/codesearch#chromium/src/media/blink/webmediaplayer_impl.cc&rcl=1428421466&l=446)
And another part of CL 740663002 will make sure Pipeline::GetMediaTime
also returns duration_ after end-of-stream has been reached by renderer

I've verified this CL by running media_unittests and internal
Chromecast MSE unit tests.

BUG=475244

Review URL: https://codereview.chromium.org/1069253004

Cr-Commit-Position: refs/heads/master@{#324470}
2 files changed