diff options
-rw-r--r-- | media/base/media_switches.cc | 1 | ||||
-rw-r--r-- | media/base/media_switches.h | 1 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer.cc | 4 | ||||
-rw-r--r-- | media/filters/omx_video_decode_engine.cc | 30 | ||||
-rw-r--r-- | media/tools/player_x11/player_x11.cc | 1 |
5 files changed, 19 insertions, 18 deletions
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 1179f03..7fa286e 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc @@ -11,7 +11,6 @@ namespace switches { const char kAlsaDevice[] = "alsa-device"; #endif -const char kEnableH264AnnexbFilter[] = "enable-h264-annexb-filter"; const char kEnableOpenMax[] = "enable-openmax"; } // namespace switches diff --git a/media/base/media_switches.h b/media/base/media_switches.h index e99ba27..28e3bb6 100644 --- a/media/base/media_switches.h +++ b/media/base/media_switches.h @@ -15,7 +15,6 @@ namespace switches { extern const char kAlsaDevice[]; #endif -extern const char kEnableH264AnnexbFilter[]; extern const char kEnableOpenMax[]; } // namespace switches diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index 6ae1cb9..8c3a0a1 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -492,11 +492,11 @@ void FFmpegDemuxer::DemuxTask() { DCHECK_LT(packet->stream_index, static_cast<int>(packet_streams_.size())); FFmpegDemuxerStream* demuxer_stream = packet_streams_[packet->stream_index]; if (demuxer_stream) { - using switches::kEnableH264AnnexbFilter; + using switches::kEnableOpenMax; AVCodecContext* stream_context = format_context_->streams[packet->stream_index]->codec; if (stream_context->codec_id == CODEC_ID_H264 && - CommandLine::ForCurrentProcess()->HasSwitch(kEnableH264AnnexbFilter)) { + CommandLine::ForCurrentProcess()->HasSwitch(kEnableOpenMax)) { // TODO(ajwong): Unittest this branch of the if statement. // Also, move this code into the FFmpegDemuxerStream, so that the decoder // can enable a filter in the stream as needed. diff --git a/media/filters/omx_video_decode_engine.cc b/media/filters/omx_video_decode_engine.cc index 3bcc876..4b6d081 100644 --- a/media/filters/omx_video_decode_engine.cc +++ b/media/filters/omx_video_decode_engine.cc @@ -141,8 +141,9 @@ VideoSurface::Format OmxVideoDecodeEngine::GetSurfaceFormat() const { } void OmxVideoDecodeEngine::Stop(Callback0::Type* done_cb) { - DCHECK_EQ(message_loop_, MessageLoop::current()); omx_codec_->Stop(done_cb); + + // TODO(hclam): make sure writing to state_ is safe. state_ = kStopped; } @@ -171,20 +172,21 @@ void OmxVideoDecodeEngine::StopUsingThisBuffer(int id) { void OmxVideoDecodeEngine::BufferReady(int buffer_id, BufferUsedCallback* callback) { DCHECK_EQ(message_loop_, MessageLoop::current()); - CHECK(buffer_id != OmxCodec::kEosBuffer); - CHECK(callback); + CHECK((buffer_id == OmxCodec::kEosBuffer) || callback); // Obtain the corresponding OMX_BUFFERHEADERTYPE. - OmxBufferList::iterator i = FindBuffer(buffer_id); - uint8* buffer = i->second->pBuffer; - int size = i->second->nFilledLen; + OmxBufferList::iterator iter = FindBuffer(buffer_id); + if (iter != omx_buffers_.end()) { + uint8* buffer = iter->second->pBuffer; + int size = iter->second->nFilledLen; - if ((size_t)size != frame_bytes_) { - LOG(ERROR) << "Read completed with weird size: " << size; - } + if ((size_t)size != frame_bytes_) { + LOG(ERROR) << "Read completed with weird size: " << size; + } - // Merge the buffer into previous buffers. - MergeBytesFrameQueue(buffer, size); + // Merge the buffer into previous buffers. + MergeBytesFrameQueue(buffer, size); + } // We assume that when we receive a read complete callback from // OmxCodec there was a read request made. @@ -222,7 +224,10 @@ void OmxVideoDecodeEngine::BufferReady(int buffer_id, request.done_cb->Run(); // Notify OmxCodec that we have finished using this buffer. - callback->RunWithParams(MakeTuple(buffer_id)); + if (callback) { + callback->Run(buffer_id); + delete callback; + } } void OmxVideoDecodeEngine::OnReadComplete( @@ -263,7 +268,6 @@ OmxVideoDecodeEngine::FindBuffer(int buffer_id) { if (i->first == buffer_id) return i; } - NOTREACHED() << "Invalid buffer id received"; return omx_buffers_.end(); } diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc index a78c6d4..41207fd 100644 --- a/media/tools/player_x11/player_x11.cc +++ b/media/tools/player_x11/player_x11.cc @@ -120,7 +120,6 @@ int main(int argc, char** argv) { << std::endl << "Optional arguments:" << std::endl << " [--enable-openmax]" - << " [--enable-h264-annexb-filter]" << " [--audio]" << " [--alsa-device=DEVICE]" << std::endl; return 1; |