| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/remoting/remote_demuxer_stream_adapter.h" | 5 #include "media/remoting/remote_demuxer_stream_adapter.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "media/base/bind_to_current_loop.h" | 9 #include "media/base/bind_to_current_loop.h" |
| 10 #include "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 void RemoteDemuxerStreamAdapter::OnReceivedRpc( | 109 void RemoteDemuxerStreamAdapter::OnReceivedRpc( |
| 110 std::unique_ptr<remoting::pb::RpcMessage> message) { | 110 std::unique_ptr<remoting::pb::RpcMessage> message) { |
| 111 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 111 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 112 DCHECK(message); | 112 DCHECK(message); |
| 113 DCHECK(rpc_handle_ == message->handle()); | 113 DCHECK(rpc_handle_ == message->handle()); |
| 114 | 114 |
| 115 switch (message->proc()) { | 115 switch (message->proc()) { |
| 116 case remoting::pb::RpcMessage::RPC_DS_INITIALIZE: | 116 case remoting::pb::RpcMessage::RPC_DS_INITIALIZE: |
| 117 Initialize(message->integer_value()); | 117 Initialize(message->integer_value()); |
| 118 break; | 118 break; |
| 119 case remoting::pb::RpcMessage::RPC_DS_ENABLEBITSTREAMCONVERTER: |
| 120 EnableBitstreamConverter(); |
| 121 break; |
| 119 case remoting::pb::RpcMessage::RPC_DS_READUNTIL: | 122 case remoting::pb::RpcMessage::RPC_DS_READUNTIL: |
| 120 ReadUntil(std::move(message)); | 123 ReadUntil(std::move(message)); |
| 121 break; | 124 break; |
| 122 default: | 125 default: |
| 123 VLOG(2) << "Unknown RPC: " << message->proc(); | 126 VLOG(2) << "Unknown RPC: " << message->proc(); |
| 124 } | 127 } |
| 125 } | 128 } |
| 126 | 129 |
| 127 void RemoteDemuxerStreamAdapter::Initialize(int remote_callback_handle) { | 130 void RemoteDemuxerStreamAdapter::Initialize(int remote_callback_handle) { |
| 128 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 131 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 break; | 171 break; |
| 169 } | 172 } |
| 170 default: | 173 default: |
| 171 NOTREACHED(); | 174 NOTREACHED(); |
| 172 } | 175 } |
| 173 main_task_runner_->PostTask( | 176 main_task_runner_->PostTask( |
| 174 FROM_HERE, base::Bind(&remoting::RpcBroker::SendMessageToRemote, | 177 FROM_HERE, base::Bind(&remoting::RpcBroker::SendMessageToRemote, |
| 175 rpc_broker_, base::Passed(&rpc))); | 178 rpc_broker_, base::Passed(&rpc))); |
| 176 } | 179 } |
| 177 | 180 |
| 181 void RemoteDemuxerStreamAdapter::EnableBitstreamConverter() { |
| 182 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 183 demuxer_stream_->EnableBitstreamConverter(); |
| 184 } |
| 185 |
| 178 void RemoteDemuxerStreamAdapter::ReadUntil( | 186 void RemoteDemuxerStreamAdapter::ReadUntil( |
| 179 std::unique_ptr<remoting::pb::RpcMessage> message) { | 187 std::unique_ptr<remoting::pb::RpcMessage> message) { |
| 180 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 188 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 181 DCHECK(message); | 189 DCHECK(message); |
| 182 if (pending_flush_) { | 190 if (pending_flush_) { |
| 183 VLOG(2) << "Skip actions since it's in the flushing state"; | 191 VLOG(2) << "Skip actions since it's in the flushing state"; |
| 184 return; | 192 return; |
| 185 } | 193 } |
| 186 | 194 |
| 187 if (processing_read_rpc_) { | 195 if (processing_read_rpc_) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 391 } |
| 384 | 392 |
| 385 if (write_watcher_.IsWatching()) { | 393 if (write_watcher_.IsWatching()) { |
| 386 VLOG(2) << "Cancel mojo data pipe watcher"; | 394 VLOG(2) << "Cancel mojo data pipe watcher"; |
| 387 write_watcher_.Cancel(); | 395 write_watcher_.Cancel(); |
| 388 } | 396 } |
| 389 } | 397 } |
| 390 | 398 |
| 391 } // namespace remoting | 399 } // namespace remoting |
| 392 } // namespace media | 400 } // namespace media |
| OLD | NEW |