Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-27 03:35:10 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-07-27 03:55:17 +0400
commitd1ce43a3e8fe18e29a334b1a2fda82215f86f2b9 (patch)
tree56f2dc515c1edc2aa0e1bbed648aaab77556d13e /doc/examples/muxing.c
parentfbd46e2f1caeb190a601f0f600b6199e632d7292 (diff)
doc/examples/muxing: mark correct frame as writeable
Bug found from comparing 56f98e340fca894a76d1ddbe33118b8d8c4db34a to HEAD Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/examples/muxing.c')
-rw-r--r--doc/examples/muxing.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 2d97fde387..4216a563a7 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -266,7 +266,7 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A
* 'nb_channels' channels. */
static AVFrame *get_audio_frame(OutputStream *ost)
{
- int j, i, v, ret;
+ int j, i, v;
int16_t *q = (int16_t*)ost->frame->data[0];
/* check if we want to generate more frames */
@@ -274,14 +274,6 @@ static AVFrame *get_audio_frame(OutputStream *ost)
STREAM_DURATION, (AVRational){ 1, 1 }) >= 0)
return NULL;
- /* when we pass a frame to the encoder, it may keep a reference to it
- * internally;
- * make sure we do not overwrite it here
- */
- ret = av_frame_make_writable(ost->frame);
- if (ret < 0)
- exit(1);
-
for (j = 0; j < ost->frame->nb_samples; j++) {
v = (int)(sin(ost->t) * 10000);
for (i = 0; i < ost->st->codec->channels; i++)
@@ -321,6 +313,14 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
c->sample_rate, c->sample_rate, AV_ROUND_UP);
av_assert0(dst_nb_samples == frame->nb_samples);
+ /* when we pass a frame to the encoder, it may keep a reference to it
+ * internally;
+ * make sure we do not overwrite it here
+ */
+ ret = av_frame_make_writable(ost->tmp_frame);
+ if (ret < 0)
+ exit(1);
+
/* convert to destination format */
ret = swr_convert(ost->swr_ctx,
ost->tmp_frame->data, dst_nb_samples,