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

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

Issue 6206001: Merge 70669 - Don't uninitialize FFmpegVideoDecodeEngine if we haven't initia... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/597/src/
Patch Set: Created 9 years, 11 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_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <deque> 7 #include <deque>
8 8
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "media/base/callback.h" 10 #include "media/base/callback.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 case CODEC_ID_MPEG4: 90 case CODEC_ID_MPEG4:
91 config.codec = kCodecMPEG4; break; 91 config.codec = kCodecMPEG4; break;
92 case CODEC_ID_VP8: 92 case CODEC_ID_VP8:
93 config.codec = kCodecVP8; break; 93 config.codec = kCodecVP8; break;
94 default: 94 default:
95 NOTREACHED(); 95 NOTREACHED();
96 } 96 }
97 config.opaque_context = av_stream; 97 config.opaque_context = av_stream;
98 config.width = width_; 98 config.width = width_;
99 config.height = height_; 99 config.height = height_;
100 state_ = kInitializing;
100 decode_engine_->Initialize(message_loop(), this, NULL, config); 101 decode_engine_->Initialize(message_loop(), this, NULL, config);
101 } 102 }
102 103
103 void FFmpegVideoDecoder::OnInitializeComplete(const VideoCodecInfo& info) { 104 void FFmpegVideoDecoder::OnInitializeComplete(const VideoCodecInfo& info) {
104 DCHECK_EQ(MessageLoop::current(), message_loop()); 105 DCHECK_EQ(MessageLoop::current(), message_loop());
105 DCHECK(initialize_callback_.get()); 106 DCHECK(initialize_callback_.get());
106 107
107 info_ = info; // Save a copy. 108 info_ = info; // Save a copy.
108 109
109 if (info.success) { 110 if (info.success) {
(...skipping 22 matching lines...) Expand all
132 NewRunnableMethod(this, 133 NewRunnableMethod(this,
133 &FFmpegVideoDecoder::Stop, 134 &FFmpegVideoDecoder::Stop,
134 callback)); 135 callback));
135 return; 136 return;
136 } 137 }
137 138
138 DCHECK_EQ(MessageLoop::current(), message_loop()); 139 DCHECK_EQ(MessageLoop::current(), message_loop());
139 DCHECK(!uninitialize_callback_.get()); 140 DCHECK(!uninitialize_callback_.get());
140 141
141 uninitialize_callback_.reset(callback); 142 uninitialize_callback_.reset(callback);
142 decode_engine_->Uninitialize(); 143 if (state_ != kUnInitialized)
144 decode_engine_->Uninitialize();
145 else
146 OnUninitializeComplete();
143 } 147 }
144 148
145 void FFmpegVideoDecoder::OnUninitializeComplete() { 149 void FFmpegVideoDecoder::OnUninitializeComplete() {
146 DCHECK_EQ(MessageLoop::current(), message_loop()); 150 DCHECK_EQ(MessageLoop::current(), message_loop());
147 DCHECK(uninitialize_callback_.get()); 151 DCHECK(uninitialize_callback_.get());
148 152
149 AutoCallbackRunner done_runner(uninitialize_callback_.release()); 153 AutoCallbackRunner done_runner(uninitialize_callback_.release());
150 state_ = kStopped; 154 state_ = kStopped;
151 155
152 // TODO(jiesun): Destroy the decoder context. 156 // TODO(jiesun): Destroy the decoder context.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 VideoFrameReady(video_frame); 436 VideoFrameReady(video_frame);
433 } 437 }
434 } 438 }
435 439
436 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( 440 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest(
437 VideoDecodeEngine* engine) { 441 VideoDecodeEngine* engine) {
438 decode_engine_.reset(engine); 442 decode_engine_.reset(engine);
439 } 443 }
440 444
441 } // namespace media 445 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698