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

Unified Diff: media/mojo/services/mojo_demuxer_stream_adapter.cc

Issue 2416183002: media: Use native DemuxerStream enum types in media mojo interfaces (Closed)
Patch Set: comments addressed Created 4 years, 2 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/services/mojo_demuxer_stream_adapter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_demuxer_stream_adapter.cc
diff --git a/media/mojo/services/mojo_demuxer_stream_adapter.cc b/media/mojo/services/mojo_demuxer_stream_adapter.cc
index f302a2ce49421047829cd624b44edabd218b0fda..c182562a41435f21cbcb0cdb7bb0d412e9a1f7ed 100644
--- a/media/mojo/services/mojo_demuxer_stream_adapter.cc
+++ b/media/mojo/services/mojo_demuxer_stream_adapter.cc
@@ -22,7 +22,7 @@ MojoDemuxerStreamAdapter::MojoDemuxerStreamAdapter(
const base::Closure& stream_ready_cb)
: demuxer_stream_(std::move(demuxer_stream)),
stream_ready_cb_(stream_ready_cb),
- type_(DemuxerStream::UNKNOWN),
+ type_(UNKNOWN),
weak_factory_(this) {
DVLOG(1) << __FUNCTION__;
demuxer_stream_->Initialize(base::Bind(
@@ -33,7 +33,7 @@ MojoDemuxerStreamAdapter::~MojoDemuxerStreamAdapter() {
DVLOG(1) << __FUNCTION__;
}
-void MojoDemuxerStreamAdapter::Read(const DemuxerStream::ReadCB& read_cb) {
+void MojoDemuxerStreamAdapter::Read(const ReadCB& read_cb) {
DVLOG(3) << __FUNCTION__;
// We shouldn't be holding on to a previous callback if a new Read() came in.
DCHECK(read_cb_.is_null());
@@ -44,12 +44,12 @@ void MojoDemuxerStreamAdapter::Read(const DemuxerStream::ReadCB& read_cb) {
}
AudioDecoderConfig MojoDemuxerStreamAdapter::audio_decoder_config() {
- DCHECK_EQ(type_, DemuxerStream::AUDIO);
+ DCHECK_EQ(type_, AUDIO);
return audio_config_;
}
VideoDecoderConfig MojoDemuxerStreamAdapter::video_decoder_config() {
- DCHECK_EQ(type_, DemuxerStream::VIDEO);
+ DCHECK_EQ(type_, VIDEO);
return video_config_;
}
@@ -86,15 +86,15 @@ void MojoDemuxerStreamAdapter::SetStreamStatusChangeCB(
// TODO(xhwang): Pass liveness here.
void MojoDemuxerStreamAdapter::OnStreamReady(
- mojom::DemuxerStream::Type type,
+ Type type,
mojo::ScopedDataPipeConsumerHandle consumer_handle,
mojom::AudioDecoderConfigPtr audio_config,
mojom::VideoDecoderConfigPtr video_config) {
DVLOG(1) << __FUNCTION__;
- DCHECK_EQ(DemuxerStream::UNKNOWN, type_);
+ DCHECK_EQ(UNKNOWN, type_);
DCHECK(consumer_handle.is_valid());
- type_ = static_cast<DemuxerStream::Type>(type);
+ type_ = type;
mojo_decoder_buffer_reader_.reset(
new MojoDecoderBufferReader(std::move(consumer_handle)));
@@ -105,48 +105,48 @@ void MojoDemuxerStreamAdapter::OnStreamReady(
}
void MojoDemuxerStreamAdapter::OnBufferReady(
- mojom::DemuxerStream::Status status,
+ Status status,
mojom::DecoderBufferPtr buffer,
mojom::AudioDecoderConfigPtr audio_config,
mojom::VideoDecoderConfigPtr video_config) {
DVLOG(3) << __FUNCTION__;
DCHECK(!read_cb_.is_null());
- DCHECK_NE(type_, DemuxerStream::UNKNOWN);
+ DCHECK_NE(type_, UNKNOWN);
- if (status == mojom::DemuxerStream::Status::CONFIG_CHANGED) {
+ if (status == kConfigChanged) {
UpdateConfig(std::move(audio_config), std::move(video_config));
- base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kConfigChanged, nullptr);
+ base::ResetAndReturn(&read_cb_).Run(kConfigChanged, nullptr);
return;
}
- if (status == mojom::DemuxerStream::Status::ABORTED) {
- base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr);
+ if (status == kAborted) {
+ base::ResetAndReturn(&read_cb_).Run(kAborted, nullptr);
return;
}
- DCHECK_EQ(status, mojom::DemuxerStream::Status::OK);
+ DCHECK_EQ(status, kOk);
scoped_refptr<DecoderBuffer> media_buffer =
mojo_decoder_buffer_reader_->ReadDecoderBuffer(buffer);
if (!media_buffer) {
- base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr);
+ base::ResetAndReturn(&read_cb_).Run(kAborted, nullptr);
return;
}
- base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kOk, media_buffer);
+ base::ResetAndReturn(&read_cb_).Run(kOk, media_buffer);
}
void MojoDemuxerStreamAdapter::UpdateConfig(
mojom::AudioDecoderConfigPtr audio_config,
mojom::VideoDecoderConfigPtr video_config) {
- DCHECK_NE(type_, DemuxerStream::UNKNOWN);
+ DCHECK_NE(type_, UNKNOWN);
switch(type_) {
- case DemuxerStream::AUDIO:
+ case AUDIO:
DCHECK(audio_config && !video_config);
audio_config_ = audio_config.To<AudioDecoderConfig>();
break;
- case DemuxerStream::VIDEO:
+ case VIDEO:
DCHECK(video_config && !audio_config);
video_config_ = video_config.To<VideoDecoderConfig>();
break;
« no previous file with comments | « media/mojo/services/mojo_demuxer_stream_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698