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

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

Issue 286953005: Roll FFmpeg for M37. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Final DEPS. 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
Index: media/cast/test/sender.cc
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc
index 9dd3581e30dfe6740495366983e41f19b45e699e..182d2b9f0e488634d243a82f9667940c5fa113c7 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,7 +619,6 @@ 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;

Powered by Google App Engine
This is Rietveld 408576698