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

Unified Diff: media/cast/test/sender.cc

Issue 286953005: Roll FFmpeg for M37. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Roll DEPS for ChromiumOS fixes. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/media_file_checker.cc ('k') | media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/test/sender.cc
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc
index 9dd3581e30dfe6740495366983e41f19b45e699e..e457e2c9fe4b3f475335b764447b8d51f2e596f7 100644
--- a/media/cast/test/sender.cc
+++ b/media/cast/test/sender.cc
@@ -140,7 +140,7 @@ VideoSenderConfig GetVideoSenderConfig() {
return video_config;
}
-void AVFreeFrame(AVFrame* frame) { avcodec_free_frame(&frame); }
+void AVFreeFrame(AVFrame* frame) { av_frame_free(&frame); }
class SendProcess {
public:
@@ -533,11 +533,11 @@ class SendProcess {
// Audio.
AVFrame* avframe = av_frame_alloc();
- // Shallow copy of the packet.
+ // Make a shallow copy of packet so we can slide packet.data as frames are
+ // decoded from the packet; otherwise av_free_packet() will corrupt memory.
AVPacket packet_temp = *packet.get();
do {
- avcodec_get_frame_defaults(avframe);
int frame_decoded = 0;
int result = avcodec_decode_audio4(
av_audio_context(), avframe, &frame_decoded, &packet_temp);
@@ -577,8 +577,9 @@ class SendProcess {
// Note: Not all files have correct values for pkt_pts.
base::TimeDelta::FromMilliseconds(avframe->pkt_pts));
audio_algo_.EnqueueBuffer(buffer);
+ av_frame_unref(avframe);
} while (packet_temp.size > 0);
- avcodec_free_frame(&avframe);
+ av_frame_free(&avframe);
const int frames_needed_to_scale =
playback_rate_ * av_audio_context()->sample_rate /
@@ -618,15 +619,16 @@ class SendProcess {
// Video.
int got_picture;
AVFrame* avframe = av_frame_alloc();
- avcodec_get_frame_defaults(avframe);
// Tell the decoder to reorder for us.
avframe->reordered_opaque =
av_video_context()->reordered_opaque = packet->pts;
CHECK(avcodec_decode_video2(
av_video_context(), avframe, &got_picture, packet.get()) >= 0)
<< "Video decode error.";
- if (!got_picture)
+ if (!got_picture) {
+ av_frame_free(&avframe);
return;
+ }
gfx::Size size(av_video_context()->width, av_video_context()->height);
if (!video_first_pts_set_ ||
avframe->reordered_opaque < video_first_pts_) {
« no previous file with comments | « media/base/media_file_checker.cc ('k') | media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698