diff options
author | servolk <servolk@chromium.org> | 2016-03-24 21:55:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 04:57:22 +0000 |
commit | ef1e5efdbb7458908a9018e92ab59ba24b43f8ca (patch) | |
tree | 310b38d429331d452ad0c292f80d71ab9ed8baa9 /media | |
parent | 8fa624a7bf8691add1be505d98060267e90368d1 (diff) | |
download | chromium_src-ef1e5efdbb7458908a9018e92ab59ba24b43f8ca.zip chromium_src-ef1e5efdbb7458908a9018e92ab59ba24b43f8ca.tar.gz chromium_src-ef1e5efdbb7458908a9018e92ab59ba24b43f8ca.tar.bz2 |
Pass ffmpeg media track info to HTMLMediaElement
This CL implements passing FFmpeg track info generated by FFmpegDemuxer
to blink HTMLMediaElement. Also adds a few new blink layout tests for
that.
BUG=249427
Review URL: https://codereview.chromium.org/1735763002
Cr-Commit-Position: refs/heads/master@{#383250}
Diffstat (limited to 'media')
-rw-r--r-- | media/blink/webmediaplayer_impl.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index f9cef4c..6d8aa58 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc @@ -204,6 +204,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( suppress_destruction_errors_(false) { DCHECK(!adjust_allocated_memory_cb_.is_null()); DCHECK(renderer_factory_); + DCHECK(client_); if (delegate_) delegate_id_ = delegate_->AddObserver(this); @@ -826,6 +827,30 @@ void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( // WebSourceBufferImpl. DCHECK(demuxer_.get()); DCHECK(!chunk_demuxer_); + + // Report the media track information to blink. + for (const auto& track : tracks->tracks()) { + if (track->type() == MediaTrack::Audio) { + auto track_id = client_->addAudioTrack( + blink::WebString::fromUTF8(track->id()), + blink::WebMediaPlayerClient::AudioTrackKindMain, + blink::WebString::fromUTF8(track->label()), + blink::WebString::fromUTF8(track->language()), + /*enabled*/ true); + (void)track_id; + } else if (track->type() == MediaTrack::Video) { + auto track_id = client_->addVideoTrack( + blink::WebString::fromUTF8(track->id()), + blink::WebMediaPlayerClient::VideoTrackKindMain, + blink::WebString::fromUTF8(track->label()), + blink::WebString::fromUTF8(track->language()), + /*selected*/ true); + (void)track_id; + } else { + // Text tracks are not supported through this code path yet. + NOTREACHED(); + } + } } void WebMediaPlayerImpl::OnWaitingForDecryptionKey() { @@ -1305,8 +1330,7 @@ void WebMediaPlayerImpl::StartPipeline() { #if !defined(MEDIA_DISABLE_FFMPEG) Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb = - base::Bind(&WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated, - base::Unretained(this)); + BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated); demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), encrypted_media_init_data_cb, |