| OLD | NEW |
| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 audio_config = | 90 audio_config = |
| 91 interfaces::AudioDecoderConfig::From(stream_->audio_decoder_config()); | 91 interfaces::AudioDecoderConfig::From(stream_->audio_decoder_config()); |
| 92 } else if (stream_->type() == media::DemuxerStream::VIDEO) { | 92 } else if (stream_->type() == media::DemuxerStream::VIDEO) { |
| 93 video_config = | 93 video_config = |
| 94 interfaces::VideoDecoderConfig::From(stream_->video_decoder_config()); | 94 interfaces::VideoDecoderConfig::From(stream_->video_decoder_config()); |
| 95 } else { | 95 } else { |
| 96 NOTREACHED() << "Unsupported config change encountered for type: " | 96 NOTREACHED() << "Unsupported config change encountered for type: " |
| 97 << stream_->type(); | 97 << stream_->type(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 callback.Run(interfaces::DemuxerStream::STATUS_CONFIG_CHANGED, | 100 callback.Run(interfaces::DemuxerStream::Status::CONFIG_CHANGED, |
| 101 interfaces::DecoderBufferPtr(), std::move(audio_config), | 101 interfaces::DecoderBufferPtr(), std::move(audio_config), |
| 102 std::move(video_config)); | 102 std::move(video_config)); |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 | 105 |
| 106 if (status == media::DemuxerStream::kAborted) { | 106 if (status == media::DemuxerStream::kAborted) { |
| 107 callback.Run(interfaces::DemuxerStream::STATUS_ABORTED, | 107 callback.Run(interfaces::DemuxerStream::Status::ABORTED, |
| 108 interfaces::DecoderBufferPtr(), std::move(audio_config), | 108 interfaces::DecoderBufferPtr(), std::move(audio_config), |
| 109 std::move(video_config)); | 109 std::move(video_config)); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 | 112 |
| 113 DCHECK_EQ(status, media::DemuxerStream::kOk); | 113 DCHECK_EQ(status, media::DemuxerStream::kOk); |
| 114 if (!buffer->end_of_stream()) { | 114 if (!buffer->end_of_stream()) { |
| 115 DCHECK_GT(buffer->data_size(), 0u); | 115 DCHECK_GT(buffer->data_size(), 0u); |
| 116 // Serialize the data section of the DecoderBuffer into our pipe. | 116 // Serialize the data section of the DecoderBuffer into our pipe. |
| 117 uint32_t bytes_to_write = base::checked_cast<uint32_t>(buffer->data_size()); | 117 uint32_t bytes_to_write = base::checked_cast<uint32_t>(buffer->data_size()); |
| 118 uint32_t bytes_written = bytes_to_write; | 118 uint32_t bytes_written = bytes_to_write; |
| 119 CHECK_EQ(WriteDataRaw(stream_pipe_.get(), buffer->data(), &bytes_written, | 119 CHECK_EQ(WriteDataRaw(stream_pipe_.get(), buffer->data(), &bytes_written, |
| 120 MOJO_READ_DATA_FLAG_ALL_OR_NONE), | 120 MOJO_READ_DATA_FLAG_ALL_OR_NONE), |
| 121 MOJO_RESULT_OK); | 121 MOJO_RESULT_OK); |
| 122 CHECK_EQ(bytes_to_write, bytes_written); | 122 CHECK_EQ(bytes_to_write, bytes_written); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via | 125 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via |
| 126 // the producer handle and then read more to keep the pipe full. Waiting for | 126 // the producer handle and then read more to keep the pipe full. Waiting for |
| 127 // space can be accomplished using an AsyncWaiter. | 127 // space can be accomplished using an AsyncWaiter. |
| 128 callback.Run(static_cast<interfaces::DemuxerStream::Status>(status), | 128 callback.Run(static_cast<interfaces::DemuxerStream::Status>(status), |
| 129 interfaces::DecoderBuffer::From(buffer), std::move(audio_config), | 129 interfaces::DecoderBuffer::From(buffer), std::move(audio_config), |
| 130 std::move(video_config)); | 130 std::move(video_config)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace media | 133 } // namespace media |
| OLD | NEW |