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

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

Issue 1544313002: Convert Pass()→std::move() in //media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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_adapter.h" 5 #include "media/mojo/services/mojo_demuxer_stream_adapter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
11 #include "media/base/decoder_buffer.h" 12 #include "media/base/decoder_buffer.h"
12 #include "media/mojo/services/media_type_converters.h" 13 #include "media/mojo/services/media_type_converters.h"
13 #include "mojo/public/cpp/system/data_pipe.h" 14 #include "mojo/public/cpp/system/data_pipe.h"
14 15
15 namespace media { 16 namespace media {
16 17
17 MojoDemuxerStreamAdapter::MojoDemuxerStreamAdapter( 18 MojoDemuxerStreamAdapter::MojoDemuxerStreamAdapter(
18 interfaces::DemuxerStreamPtr demuxer_stream, 19 interfaces::DemuxerStreamPtr demuxer_stream,
19 const base::Closure& stream_ready_cb) 20 const base::Closure& stream_ready_cb)
20 : demuxer_stream_(demuxer_stream.Pass()), 21 : demuxer_stream_(std::move(demuxer_stream)),
21 stream_ready_cb_(stream_ready_cb), 22 stream_ready_cb_(stream_ready_cb),
22 type_(DemuxerStream::UNKNOWN), 23 type_(DemuxerStream::UNKNOWN),
23 weak_factory_(this) { 24 weak_factory_(this) {
24 DVLOG(1) << __FUNCTION__; 25 DVLOG(1) << __FUNCTION__;
25 demuxer_stream_->Initialize(base::Bind( 26 demuxer_stream_->Initialize(base::Bind(
26 &MojoDemuxerStreamAdapter::OnStreamReady, weak_factory_.GetWeakPtr())); 27 &MojoDemuxerStreamAdapter::OnStreamReady, weak_factory_.GetWeakPtr()));
27 } 28 }
28 29
29 MojoDemuxerStreamAdapter::~MojoDemuxerStreamAdapter() { 30 MojoDemuxerStreamAdapter::~MojoDemuxerStreamAdapter() {
30 DVLOG(1) << __FUNCTION__; 31 DVLOG(1) << __FUNCTION__;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void MojoDemuxerStreamAdapter::OnStreamReady( 73 void MojoDemuxerStreamAdapter::OnStreamReady(
73 interfaces::DemuxerStream::Type type, 74 interfaces::DemuxerStream::Type type,
74 mojo::ScopedDataPipeConsumerHandle pipe, 75 mojo::ScopedDataPipeConsumerHandle pipe,
75 interfaces::AudioDecoderConfigPtr audio_config, 76 interfaces::AudioDecoderConfigPtr audio_config,
76 interfaces::VideoDecoderConfigPtr video_config) { 77 interfaces::VideoDecoderConfigPtr video_config) {
77 DVLOG(1) << __FUNCTION__; 78 DVLOG(1) << __FUNCTION__;
78 DCHECK(pipe.is_valid()); 79 DCHECK(pipe.is_valid());
79 DCHECK_EQ(DemuxerStream::UNKNOWN, type_); 80 DCHECK_EQ(DemuxerStream::UNKNOWN, type_);
80 81
81 type_ = static_cast<DemuxerStream::Type>(type); 82 type_ = static_cast<DemuxerStream::Type>(type);
82 stream_pipe_ = pipe.Pass(); 83 stream_pipe_ = std::move(pipe);
83 UpdateConfig(audio_config.Pass(), video_config.Pass()); 84 UpdateConfig(std::move(audio_config), std::move(video_config));
84 85
85 stream_ready_cb_.Run(); 86 stream_ready_cb_.Run();
86 } 87 }
87 88
88 void MojoDemuxerStreamAdapter::OnBufferReady( 89 void MojoDemuxerStreamAdapter::OnBufferReady(
89 interfaces::DemuxerStream::Status status, 90 interfaces::DemuxerStream::Status status,
90 interfaces::DecoderBufferPtr buffer, 91 interfaces::DecoderBufferPtr buffer,
91 interfaces::AudioDecoderConfigPtr audio_config, 92 interfaces::AudioDecoderConfigPtr audio_config,
92 interfaces::VideoDecoderConfigPtr video_config) { 93 interfaces::VideoDecoderConfigPtr video_config) {
93 DVLOG(3) << __FUNCTION__; 94 DVLOG(3) << __FUNCTION__;
94 DCHECK(!read_cb_.is_null()); 95 DCHECK(!read_cb_.is_null());
95 DCHECK_NE(type_, DemuxerStream::UNKNOWN); 96 DCHECK_NE(type_, DemuxerStream::UNKNOWN);
96 DCHECK(stream_pipe_.is_valid()); 97 DCHECK(stream_pipe_.is_valid());
97 98
98 if (status == interfaces::DemuxerStream::STATUS_CONFIG_CHANGED) { 99 if (status == interfaces::DemuxerStream::STATUS_CONFIG_CHANGED) {
99 UpdateConfig(audio_config.Pass(), video_config.Pass()); 100 UpdateConfig(std::move(audio_config), std::move(video_config));
100 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kConfigChanged, nullptr); 101 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kConfigChanged, nullptr);
101 return; 102 return;
102 } 103 }
103 104
104 if (status == interfaces::DemuxerStream::STATUS_ABORTED) { 105 if (status == interfaces::DemuxerStream::STATUS_ABORTED) {
105 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr); 106 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr);
106 return; 107 return;
107 } 108 }
108 109
109 DCHECK_EQ(status, interfaces::DemuxerStream::STATUS_OK); 110 DCHECK_EQ(status, interfaces::DemuxerStream::STATUS_OK);
(...skipping 27 matching lines...) Expand all
137 case DemuxerStream::VIDEO: 138 case DemuxerStream::VIDEO:
138 DCHECK(video_config && !audio_config); 139 DCHECK(video_config && !audio_config);
139 video_config_ = video_config.To<VideoDecoderConfig>(); 140 video_config_ = video_config.To<VideoDecoderConfig>();
140 break; 141 break;
141 default: 142 default:
142 NOTREACHED(); 143 NOTREACHED();
143 } 144 }
144 } 145 }
145 146
146 } // namespace media 147 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_decryptor_service.cc ('k') | media/mojo/services/mojo_demuxer_stream_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698