| Index: media/filters/ffmpeg_video_decoder.cc
|
| diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
|
| index 14852fff22ebb1b8362de58038356f7fcbeb5371..99f09d1ff9ca65e47a7dcc4d0babab7acc769f5a 100644
|
| --- a/media/filters/ffmpeg_video_decoder.cc
|
| +++ b/media/filters/ffmpeg_video_decoder.cc
|
| @@ -62,8 +62,7 @@ FFmpegVideoDecoder::FFmpegVideoDecoder(
|
| state_(kUninitialized),
|
| codec_context_(NULL),
|
| av_frame_(NULL),
|
| - demuxer_stream_(NULL) {
|
| -}
|
| + demuxer_stream_(NULL) {}
|
|
|
| int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
|
| AVFrame* frame) {
|
| @@ -84,8 +83,7 @@ int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
|
|
|
| gfx::Size natural_size;
|
| if (codec_context->sample_aspect_ratio.num > 0) {
|
| - natural_size = GetNaturalSize(size,
|
| - codec_context->sample_aspect_ratio.num,
|
| + natural_size = GetNaturalSize(size, codec_context->sample_aspect_ratio.num,
|
| codec_context->sample_aspect_ratio.den);
|
| } else {
|
| natural_size = demuxer_stream_->video_decoder_config().natural_size();
|
| @@ -94,9 +92,8 @@ int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
|
| if (!VideoFrame::IsValidConfig(format, size, gfx::Rect(size), natural_size))
|
| return AVERROR(EINVAL);
|
|
|
| - scoped_refptr<VideoFrame> video_frame =
|
| - VideoFrame::CreateFrame(format, size, gfx::Rect(size), natural_size,
|
| - kNoTimestamp());
|
| + scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateFrame(
|
| + format, size, gfx::Rect(size), natural_size, kNoTimestamp());
|
|
|
| for (int i = 0; i < 3; i++) {
|
| frame->base[i] = video_frame->data(i);
|
| @@ -107,8 +104,8 @@ int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
|
| frame->opaque = NULL;
|
| video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque));
|
| frame->type = FF_BUFFER_TYPE_USER;
|
| - frame->pkt_pts = codec_context->pkt ? codec_context->pkt->pts :
|
| - AV_NOPTS_VALUE;
|
| + frame->pkt_pts =
|
| + codec_context->pkt ? codec_context->pkt->pts : AV_NOPTS_VALUE;
|
| frame->width = codec_context->width;
|
| frame->height = codec_context->height;
|
| frame->format = codec_context->pix_fmt;
|
| @@ -223,13 +220,12 @@ void FFmpegVideoDecoder::ReadFromDemuxerStream() {
|
| DCHECK_NE(state_, kError);
|
| DCHECK(!read_cb_.is_null());
|
|
|
| - demuxer_stream_->Read(base::Bind(
|
| - &FFmpegVideoDecoder::BufferReady, weak_this_));
|
| + demuxer_stream_->Read(
|
| + base::Bind(&FFmpegVideoDecoder::BufferReady, weak_this_));
|
| }
|
|
|
| void FFmpegVideoDecoder::BufferReady(
|
| - DemuxerStream::Status status,
|
| - const scoped_refptr<DecoderBuffer>& buffer) {
|
| + DemuxerStream::Status status, const scoped_refptr<DecoderBuffer>& buffer) {
|
| DCHECK(message_loop_->BelongsToCurrentThread());
|
| DCHECK_NE(state_, kDecodeFinished);
|
| DCHECK_NE(state_, kError);
|
| @@ -284,7 +280,7 @@ void FFmpegVideoDecoder::DecodeBuffer(
|
| // These are the possible state transitions.
|
| //
|
| // kNormal -> kFlushCodec:
|
| - // When buffer->IsEndOfStream() is first true.
|
| + // When buffer->end_of_stream() is first true.
|
| // kNormal -> kError:
|
| // A decoding error occurs and decoding needs to stop.
|
| // kFlushCodec -> kDecodeFinished:
|
| @@ -295,7 +291,7 @@ void FFmpegVideoDecoder::DecodeBuffer(
|
| // Any time Reset() is called.
|
|
|
| // Transition to kFlushCodec on the first end of stream buffer.
|
| - if (state_ == kNormal && buffer->IsEndOfStream()) {
|
| + if (state_ == kNormal && buffer->end_of_stream()) {
|
| state_ = kFlushCodec;
|
| }
|
|
|
| @@ -307,15 +303,15 @@ void FFmpegVideoDecoder::DecodeBuffer(
|
| }
|
|
|
| // Any successful decode counts!
|
| - if (!buffer->IsEndOfStream() && buffer->GetDataSize() > 0) {
|
| + if (!buffer->end_of_stream() && buffer->data_size() > 0) {
|
| PipelineStatistics statistics;
|
| - statistics.video_bytes_decoded = buffer->GetDataSize();
|
| + statistics.video_bytes_decoded = buffer->data_size();
|
| statistics_cb_.Run(statistics);
|
| }
|
|
|
| if (!video_frame.get()) {
|
| if (state_ == kFlushCodec) {
|
| - DCHECK(buffer->IsEndOfStream());
|
| + DCHECK(buffer->end_of_stream());
|
| state_ = kDecodeFinished;
|
| base::ResetAndReturn(&read_cb_).Run(kOk, VideoFrame::CreateEmptyFrame());
|
| return;
|
| @@ -328,9 +324,8 @@ void FFmpegVideoDecoder::DecodeBuffer(
|
| base::ResetAndReturn(&read_cb_).Run(kOk, video_frame);
|
| }
|
|
|
| -bool FFmpegVideoDecoder::Decode(
|
| - const scoped_refptr<DecoderBuffer>& buffer,
|
| - scoped_refptr<VideoFrame>* video_frame) {
|
| +bool FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
|
| + scoped_refptr<VideoFrame>* video_frame) {
|
| DCHECK(video_frame);
|
|
|
| // Reset frame to default values.
|
| @@ -340,15 +335,15 @@ bool FFmpegVideoDecoder::Decode(
|
| // Due to FFmpeg API changes we no longer have const read-only pointers.
|
| AVPacket packet;
|
| av_init_packet(&packet);
|
| - if (buffer->IsEndOfStream()) {
|
| + if (buffer->end_of_stream()) {
|
| packet.data = NULL;
|
| packet.size = 0;
|
| } else {
|
| - packet.data = const_cast<uint8*>(buffer->GetData());
|
| - packet.size = buffer->GetDataSize();
|
| + packet.data = const_cast<uint8*>(buffer->data());
|
| + packet.size = buffer->data_size();
|
|
|
| // Let FFmpeg handle presentation timestamp reordering.
|
| - codec_context_->reordered_opaque = buffer->GetTimestamp().InMicroseconds();
|
| + codec_context_->reordered_opaque = buffer->timestamp().InMicroseconds();
|
|
|
| // This is for codecs not using get_buffer to initialize
|
| // |av_frame_->reordered_opaque|
|
| @@ -356,13 +351,12 @@ bool FFmpegVideoDecoder::Decode(
|
| }
|
|
|
| int frame_decoded = 0;
|
| - int result = avcodec_decode_video2(codec_context_,
|
| - av_frame_,
|
| - &frame_decoded,
|
| - &packet);
|
| + int result =
|
| + avcodec_decode_video2(codec_context_, av_frame_, &frame_decoded, &packet);
|
| // Log the problem if we can't decode a video frame and exit early.
|
| if (result < 0) {
|
| - LOG(ERROR) << "Error decoding video: " << buffer->AsHumanReadableString();
|
| + LOG(ERROR)
|
| + << "Error decoding video: " << buffer->AsHumanReadableString();
|
| *video_frame = NULL;
|
| return false;
|
| }
|
|
|