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

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

Issue 10879057: Revert changes from r152523 and split bitstream converter creation and enabling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 closure.Run(); 108 closure.Run();
109 return; 109 return;
110 } 110 }
111 DestroyVDA(); 111 DestroyVDA();
112 closure.Run(); 112 closure.Run();
113 } 113 }
114 114
115 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, 115 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream,
116 const PipelineStatusCB& orig_status_cb, 116 const PipelineStatusCB& orig_status_cb,
117 const StatisticsCB& statistics_cb) { 117 const StatisticsCB& statistics_cb) {
118 const VideoDecoderConfig& config = stream->video_decoder_config();
119 if (!gvd_loop_proxy_) { 118 if (!gvd_loop_proxy_) {
120 // FFmpegDemuxer's destructor frees/clears the AVStream underpinnings of
121 // FFmpegDemuxerStream without notifying the stream, creating a race between
122 // initialization and teardown. As a HACK until this is fixed, enable
123 // the bitstream converter before posting the Initialize() call to the video
124 // decoder thread since we know the DemuxerStream is valid at this point.
125 // See http://crbug.com/143460 for more detail.
126 // TODO(fischman): drop this hack!
127 if (config.IsValidConfig() && config.codec() == kCodecH264)
128 stream->EnableBitstreamConverter();
129
130 gvd_loop_proxy_ = base::ResetAndReturn(&message_loop_factory_cb_).Run(); 119 gvd_loop_proxy_ = base::ResetAndReturn(&message_loop_factory_cb_).Run();
131 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( 120 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind(
132 &GpuVideoDecoder::Initialize, 121 &GpuVideoDecoder::Initialize,
133 this, stream, orig_status_cb, statistics_cb)); 122 this, stream, orig_status_cb, statistics_cb));
134 return; 123 return;
135 } 124 }
136 125
137 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); 126 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
138 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( 127 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB(
139 "Media.GpuVideoDecoderInitializeStatus", orig_status_cb); 128 "Media.GpuVideoDecoderInitializeStatus", orig_status_cb);
140 129
141 DCHECK(!demuxer_stream_); 130 DCHECK(!demuxer_stream_);
142 if (!stream) { 131 if (!stream) {
143 status_cb.Run(PIPELINE_ERROR_DECODE); 132 status_cb.Run(PIPELINE_ERROR_DECODE);
144 return; 133 return;
145 } 134 }
146 135
147 // TODO(scherkus): this check should go in Pipeline prior to creating 136 // TODO(scherkus): this check should go in Pipeline prior to creating
148 // decoder objects. 137 // decoder objects.
138 const VideoDecoderConfig& config = stream->video_decoder_config();
149 if (!config.IsValidConfig()) { 139 if (!config.IsValidConfig()) {
150 DLOG(ERROR) << "Invalid video stream - " << config.AsHumanReadableString(); 140 DLOG(ERROR) << "Invalid video stream - " << config.AsHumanReadableString();
151 status_cb.Run(PIPELINE_ERROR_DECODE); 141 status_cb.Run(PIPELINE_ERROR_DECODE);
152 return; 142 return;
153 } 143 }
154 144
155 VideoDecodeAccelerator* vda = 145 VideoDecodeAccelerator* vda =
156 factories_->CreateVideoDecodeAccelerator(config.profile(), this); 146 factories_->CreateVideoDecodeAccelerator(config.profile(), this);
157 if (!vda) { 147 if (!vda) {
158 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); 148 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED);
159 return; 149 return;
160 } 150 }
161 151
152 if (config.codec() == kCodecH264)
153 stream->EnableBitstreamConverter();
154
162 demuxer_stream_ = stream; 155 demuxer_stream_ = stream;
163 statistics_cb_ = statistics_cb; 156 statistics_cb_ = statistics_cb;
164 157
165 DVLOG(1) << "GpuVideoDecoder::Initialize() succeeded."; 158 DVLOG(1) << "GpuVideoDecoder::Initialize() succeeded.";
166 vda_loop_proxy_->PostTaskAndReply( 159 vda_loop_proxy_->PostTaskAndReply(
167 FROM_HERE, 160 FROM_HERE,
168 base::Bind(&GpuVideoDecoder::SetVDA, this, vda), 161 base::Bind(&GpuVideoDecoder::SetVDA, this, vda),
169 base::Bind(status_cb, PIPELINE_OK)); 162 base::Bind(status_cb, PIPELINE_OK));
170 } 163 }
171 164
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 562
570 error_occured_ = true; 563 error_occured_ = true;
571 564
572 if (!pending_read_cb_.is_null()) { 565 if (!pending_read_cb_.is_null()) {
573 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); 566 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL);
574 return; 567 return;
575 } 568 }
576 } 569 }
577 570
578 } // namespace media 571 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698