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

Unified Diff: media/mojo/clients/mojo_renderer_impl.cc

Issue 2075193002: Fixes use-after-free in MojoDemuxerStreamImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mojo/clients/mojo_renderer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/clients/mojo_renderer_impl.cc
diff --git a/media/mojo/clients/mojo_renderer_impl.cc b/media/mojo/clients/mojo_renderer_impl.cc
index f407b89c57c7a98bcfa6b465b0911ad4d7631049..111e6fc8aaef305d30cbc482d47e8fe6a9badd90 100644
--- a/media/mojo/clients/mojo_renderer_impl.cc
+++ b/media/mojo/clients/mojo_renderer_impl.cc
@@ -44,24 +44,27 @@ void MojoRendererImpl::Initialize(
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(demuxer_stream_provider);
- demuxer_stream_provider_ = demuxer_stream_provider;
client_ = client;
init_cb_ = init_cb;
// Create audio and video mojom::DemuxerStream and bind its lifetime to
// the pipe.
DemuxerStream* const audio =
- demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO);
+ demuxer_stream_provider->GetStream(DemuxerStream::AUDIO);
DemuxerStream* const video =
- demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO);
+ demuxer_stream_provider->GetStream(DemuxerStream::VIDEO);
mojom::DemuxerStreamPtr audio_stream;
- if (audio)
- new MojoDemuxerStreamImpl(audio, GetProxy(&audio_stream));
+ if (audio) {
+ audio_stream_.reset(
+ new MojoDemuxerStreamImpl(audio, GetProxy(&audio_stream)));
+ }
mojom::DemuxerStreamPtr video_stream;
- if (video)
- new MojoDemuxerStreamImpl(video, GetProxy(&video_stream));
+ if (video) {
+ video_stream_.reset(
+ new MojoDemuxerStreamImpl(video, GetProxy(&video_stream)));
+ }
xhwang 2016/06/17 18:47:00 In theory, if the remote renderer doesn't care abo
alokp 2016/06/17 20:16:37 If we decide to support this use case it would be
alokp 2016/06/17 20:40:28 Whoops I did not think this through. You would sti
BindRemoteRendererIfNeeded();
@@ -136,13 +139,13 @@ bool MojoRendererImpl::HasAudio() {
DVLOG(1) << __FUNCTION__;
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(remote_renderer_.get()); // We always bind the renderer.
- return !!demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO);
+ return !!audio_stream_;
}
bool MojoRendererImpl::HasVideo() {
DVLOG(1) << __FUNCTION__;
DCHECK(task_runner_->BelongsToCurrentThread());
- return !!demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO);
+ return !!video_stream_;
}
void MojoRendererImpl::OnTimeUpdate(int64_t time_usec, int64_t max_time_usec) {
« no previous file with comments | « media/mojo/clients/mojo_renderer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698