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

Side by Side Diff: media/mojo/services/mojo_demuxer_stream_impl.cc

Issue 1935873002: Implement disabling and enabling media tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-control2
Patch Set: Updated comments + dchecks in ffmpeg demux stream 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/mojo/services/mojo_demuxer_stream_impl.h" 5 #include "media/mojo/services/mojo_demuxer_stream_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void MojoDemuxerStreamImpl::Read(const ReadCallback& callback) { 73 void MojoDemuxerStreamImpl::Read(const ReadCallback& callback) {
74 stream_->Read(base::Bind(&MojoDemuxerStreamImpl::OnBufferReady, 74 stream_->Read(base::Bind(&MojoDemuxerStreamImpl::OnBufferReady,
75 weak_factory_.GetWeakPtr(), callback)); 75 weak_factory_.GetWeakPtr(), callback));
76 } 76 }
77 77
78 void MojoDemuxerStreamImpl::EnableBitstreamConverter() { 78 void MojoDemuxerStreamImpl::EnableBitstreamConverter() {
79 stream_->EnableBitstreamConverter(); 79 stream_->EnableBitstreamConverter();
80 } 80 }
81 81
82 void MojoDemuxerStreamImpl::enabled(const enabledCallback& callback) {
83 callback.Run(stream_->enabled());
84 }
85
86 void MojoDemuxerStreamImpl::set_enabled(bool enabled, int64_t time_usec) {
87 stream_->set_enabled(enabled, base::TimeDelta::FromMicroseconds(time_usec));
88 }
89
82 void MojoDemuxerStreamImpl::OnBufferReady( 90 void MojoDemuxerStreamImpl::OnBufferReady(
83 const ReadCallback& callback, 91 const ReadCallback& callback,
84 media::DemuxerStream::Status status, 92 media::DemuxerStream::Status status,
85 const scoped_refptr<media::DecoderBuffer>& buffer) { 93 const scoped_refptr<media::DecoderBuffer>& buffer) {
86 mojom::AudioDecoderConfigPtr audio_config; 94 mojom::AudioDecoderConfigPtr audio_config;
87 mojom::VideoDecoderConfigPtr video_config; 95 mojom::VideoDecoderConfigPtr video_config;
88 96
89 if (status == media::DemuxerStream::kConfigChanged) { 97 if (status == media::DemuxerStream::kConfigChanged) {
90 DVLOG(2) << __FUNCTION__ << ": ConfigChange!"; 98 DVLOG(2) << __FUNCTION__ << ": ConfigChange!";
91 // Send the config change so our client can read it once it parses the 99 // Send the config change so our client can read it once it parses the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 136
129 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via 137 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via
130 // the producer handle and then read more to keep the pipe full. Waiting for 138 // the producer handle and then read more to keep the pipe full. Waiting for
131 // space can be accomplished using an AsyncWaiter. 139 // space can be accomplished using an AsyncWaiter.
132 callback.Run(static_cast<mojom::DemuxerStream::Status>(status), 140 callback.Run(static_cast<mojom::DemuxerStream::Status>(status),
133 mojom::DecoderBuffer::From(buffer), std::move(audio_config), 141 mojom::DecoderBuffer::From(buffer), std::move(audio_config),
134 std::move(video_config)); 142 std::move(video_config));
135 } 143 }
136 144
137 } // namespace media 145 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698