[MPlayer-dev-eng] : Re: [PATCH] shared memory stream - part 1

Martin Simmons vyslnqaaxytp at spammotel.com
Sun Aug 12 01:01:06 CEST 2007


>>>>> On Sat, 11 Aug 2007 23:50:55 +0200, Ötvös Attila said:
> 
> +    p->shmemmaxsize=0;
> +    for(i=0;i<p->shmemcount;i++) {               // open shared memory
> +        if (!open_shmem(shmemids[i],
> +                &(p->shmems[i].shmid),
> +                &(p->shmems[i].shmemmaxsize),
> +                &(p->shmems[i].shmptr),
> +                &(p->shmem),i)) {
> +            close_shmem(p->shmemcount,p->shmems);
> +            free(p->shmems);
> +            m_struct_free(&stream_opts,opts);
> +            return STREAM_ERROR;
> +        }
> +        if (p->shmems[i].shmemmaxsize>p->shmemmaxsize)
> +            p->shmemmaxsize=p->shmems[i].shmemmaxsize;
> +    }
> +    free(shmemids);
> +    mp_msg(MSGT_OPEN,MSGL_INFO, "Shared memory stream info:"
> +        " format=0x%x width=%d height=%d\n",p->shmem.format,p->shmem.width,
> +        p->shmem.height);
> +    p->shmemrecno = 0;
> +    p->shmid = p->shmems[p->shmemrecno].shmid;
> +    p->shmemmaxsize = p->shmems[p->shmemrecno].shmemmaxsize;

Why set p->shmemmaxsize here after computing it in the loop?

Also, I'm confused about how the shmem reading in fill_buffer is synchronized
with the writing in write_buffer.

__Martin



More information about the MPlayer-dev-eng mailing list