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

Side by Side Diff: media/filters/file_data_source.cc

Issue 39170: Pipeline_Impl was modified to properly render a stream that has video but no ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "media/base/filter_host.h" 7 #include "media/base/filter_host.h"
8 #include "media/base/filters.h" 8 #include "media/base/filters.h"
9 #include "media/base/pipeline.h" 9 #include "media/base/pipeline.h"
10 #include "media/filters/file_data_source.h" 10 #include "media/filters/file_data_source.h"
(...skipping 14 matching lines...) Expand all
25 #if defined(OS_WIN) 25 #if defined(OS_WIN)
26 FilePath file_path(UTF8ToWide(url)); 26 FilePath file_path(UTF8ToWide(url));
27 #else 27 #else
28 FilePath file_path(url); 28 FilePath file_path(url);
29 #endif 29 #endif
30 if (file_util::GetFileSize(file_path, &file_size_)) { 30 if (file_util::GetFileSize(file_path, &file_size_)) {
31 file_ = file_util::OpenFile(file_path, "rb"); 31 file_ = file_util::OpenFile(file_path, "rb");
32 } 32 }
33 if (!file_) { 33 if (!file_) {
34 file_size_ = 0; 34 file_size_ = 0;
35 host_->Error(PIPELINE_ERROR_NETWORK); 35 host_->Error(PIPELINE_ERROR_URL_NOT_FOUND);
36 return false; 36 return false;
37 } 37 }
38 media_format_.SetAsString(MediaFormat::kMimeType, 38 media_format_.SetAsString(MediaFormat::kMimeType,
39 mime_type::kApplicationOctetStream); 39 mime_type::kApplicationOctetStream);
40 media_format_.SetAsString(MediaFormat::kURL, url); 40 media_format_.SetAsString(MediaFormat::kURL, url);
41 host_->SetTotalBytes(file_size_); 41 host_->SetTotalBytes(file_size_);
42 host_->SetBufferedBytes(file_size_); 42 host_->SetBufferedBytes(file_size_);
43 host_->InitializationComplete(); 43 host_->InitializationComplete();
44 return true; 44 return true;
45 } 45 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 bool FileDataSource::GetSize(int64* size_out) { 106 bool FileDataSource::GetSize(int64* size_out) {
107 DCHECK(size_out); 107 DCHECK(size_out);
108 DCHECK(file_); 108 DCHECK(file_);
109 AutoLock l(lock_); 109 AutoLock l(lock_);
110 *size_out = file_size_; 110 *size_out = file_size_;
111 return (NULL != file_); 111 return (NULL != file_);
112 } 112 }
113 113
114 } // namespace media 114 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698