| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "chrome/renderer/media/data_source_impl.h" | 7 #include "chrome/renderer/media/data_source_impl.h" |
| 8 #include "chrome/renderer/render_view.h" | 8 #include "chrome/renderer/render_view.h" |
| 9 #include "chrome/renderer/webmediaplayer_delegate_impl.h" | 9 #include "chrome/renderer/webmediaplayer_delegate_impl.h" |
| 10 #include "media/base/filter_host.h" | 10 #include "media/base/filter_host.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (!stopped_ && stream_.get()) { | 146 if (!stopped_ && stream_.get()) { |
| 147 // net::FileStream::Read wants a char*, not uint8*. | 147 // net::FileStream::Read wants a char*, not uint8*. |
| 148 char* c_data = reinterpret_cast<char*>(data); | 148 char* c_data = reinterpret_cast<char*>(data); |
| 149 COMPILE_ASSERT(sizeof(*c_data) == sizeof(*data), data_not_sizeof_char); | 149 COMPILE_ASSERT(sizeof(*c_data) == sizeof(*data), data_not_sizeof_char); |
| 150 | 150 |
| 151 // This method IO operation is asynchronous, it is expected to return | 151 // This method IO operation is asynchronous, it is expected to return |
| 152 // ERROR_IO_PENDING, when the operation is done, OnDidFileStreamRead() will | 152 // ERROR_IO_PENDING, when the operation is done, OnDidFileStreamRead() will |
| 153 // be called. Since the file handle is asynchronous, return value other | 153 // be called. Since the file handle is asynchronous, return value other |
| 154 // than ERROR_IO_PENDING is an error. | 154 // than ERROR_IO_PENDING is an error. |
| 155 if (stream_->Read(c_data, size, &read_callback_) != net::ERR_IO_PENDING) { | 155 if (stream_->Read(c_data, size, &read_callback_) != net::ERR_IO_PENDING) { |
| 156 // TODO(hclam): change to PipelineError::PIPELINE_ERROR_READ once ralphl | 156 host_->Error(media::PIPELINE_ERROR_READ); |
| 157 // gets the new pipeline CL checked in. | |
| 158 host_->Error(media::PIPELINE_ERROR_NETWORK); | |
| 159 } | 157 } |
| 160 } | 158 } |
| 161 } | 159 } |
| 162 | 160 |
| 163 void DataSourceImpl::OnCloseFileStream() { | 161 void DataSourceImpl::OnCloseFileStream() { |
| 164 if (stream_.get()) { | 162 if (stream_.get()) { |
| 165 stream_->Close(); | 163 stream_->Close(); |
| 166 stream_.reset(); | 164 stream_.reset(); |
| 167 } | 165 } |
| 168 // Wakes up demuxer waiting on read_event_ in Read(). | 166 // Wakes up demuxer waiting on read_event_ in Read(). |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 downloaded_bytes_ += bytes; | 219 downloaded_bytes_ += bytes; |
| 222 if (!total_bytes_known_) | 220 if (!total_bytes_known_) |
| 223 total_bytes_ += bytes; | 221 total_bytes_ += bytes; |
| 224 } | 222 } |
| 225 download_event_.Signal(); | 223 download_event_.Signal(); |
| 226 } | 224 } |
| 227 | 225 |
| 228 const media::MediaFormat* DataSourceImpl::GetMediaFormat() { | 226 const media::MediaFormat* DataSourceImpl::GetMediaFormat() { |
| 229 return &media_format_; | 227 return &media_format_; |
| 230 } | 228 } |
| OLD | NEW |